MAVEN builds a multi-module project process under Eclipse. Parent-Child Projects

Source: Internet
Author: User
Tags solr

First you need to prepare JDK, MAVEN, Eclipse, Tomcat. For specific installation procedures please refer to other.
Description: We Solrcenter-war last as the final deployment project and made him dependent on modules (Solrcenter-common, Solrcentr-core)
1, first need to create the first MAVEN project (description: You can freely in your directory. I put it in the directory:E:\workspace_3_7\solrcenter):
E:\workspace_3_7\solrcenter> MVN archetype:generate-dgroupid=com.solr-dartifactid=solrcenter
Note: You may be prompted to enter a version number during the creation process, just follow the prompts, as you will have to modify the Pom.xml file after the creation is successful.
If the following occurs (Information 1) indicates that it has been successfully created:
Information 1
[INFO] Parameter:groupid, VALUE:COM.SOLR
[INFO] Parameter:packagename, VALUE:COM.SOLR
[INFO] Parameter:package, VALUE:COM.SOLR
[INFO] Parameter:artifactid, Value:solrcenter
[INFO] Parameter:basedir, Value:e:\workspace_3_7\solrcenter
[INFO] Parameter:version, Value:version
[INFO] project created from old (1.x) archetype in Dir:e:\workspace_3_7\solrcen
Ter\solrcenter
[INFO]------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO] Total time:1:01.860s
[INFO] Finished at:wed Nov 11:28:25 CST 2014
[INFO] Final memory:9m/36m
[INFO]------------------------------------------------------------------------
2. View the Pom.xml file with the following contents.

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
<modelVersion>4.0.0</modelVersion>
<groupId>com.solr</groupId>
<artifactId>solrcenter</artifactId>
<packaging>jar</packaging>
<version>version</version>
<name>solrcenter</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Modify the above packaging to Pom to become the parent project. You can also modify version according to your needs, as follows:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
<modelVersion>4.0.0</modelVersion>
<groupId>com.solr</groupId>
<artifactId>solrcenter</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>solrcenter</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

3, the creation of sub-modules, you can add unlimited. My plan is to create a war, core, common three sub-modules, first create the core, common.
CD Solrcenter
1), create the project Solrcenter-core
E:\workspace_3_7\solrcenter\solrcenter&GT;MVN Archetype:generate-dgroupid=com.solr.core-dartifactid
=solrcenter-core-darchetypeartifactid=maven-archetype-quickstart-dversion=1.0
2), create the project Solrcenter-commom
E:\workspace_3_7\solrcenter\solrcenter&GT;MVN ARCHETYPE:GENERATE-DGROUPID=COM.SOLR
. common-dartifactid=solrcenter-common-darchetypeartifactid=maven-archetype-quickstart-dversion=1.0
3), create the project Solrcenter-war
E:\workspace_3_7\solrcenter\solrcenter&GT;MVN ARCHETYPE:GENERATE-DGROUPID=COM.SOLR
-dartifactid=solrcenter-war-darchetypeartifactid=maven-archetype-webapp-dversion=1.0

Also appear after all creationInformation 1It means that it has been created successfully! As follows:

650) this.width=650; "title=" 1.png "alt=" wkiol1r1gw-w9awwaadnulsvvwe605.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 53/fd/wkiol1r1gw-w9awwaadnulsvvwe605.jpg "/>

4. Compile the project into an Eclipse project with Maven and run the following command:

E:\workspace_3_7\solrcenter\solrcenter>mvn eclipse:eclipse-dwtpversion=1.0
In this process may be error, do not care as long as the following information can be:
[INFO] solrcenter ..... ..... ...................... SUCCESS [0.896s]
[INFO] Solrcenter-core .......... ................. SUCCESS [0.424s]
[INFO] Solrcenter-common .......... ............... SUCCESS [0.276s]
[INFO] Solrcenter-war Maven Webapp .............. SUCCESS [0.284s]
[INFO]------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO] Total time:2.168s
[INFO] Finished at:wed Nov 12:58:54 CST 2014
[INFO] Final memory:7m/18m

5. Import the Solrcenter project we built into eclipse.

650) this.width=650; "title=" 2.png "style=" Float:none; "alt=" wkiom1r1gw_xpgyuaadtacu3dns326.jpg "src=" http:/ S3.51cto.com/wyfs02/m01/53/fe/wkiom1r1gw_xpgyuaadtacu3dns326.jpg "/>

Next:

650) this.width=650; "title=" 3.png "style=" Float:none; "alt=" wkiol1r1g5hjamsgaad6mzf_vze851.jpg "src=" http:/ S3.51cto.com/wyfs02/m02/53/fd/wkiol1r1g5hjamsgaad6mzf_vze851.jpg "/>


Final completion

650) this.width=650; "title=" 6.png "style=" Float:none; "alt=" wkiom1r1g86hljgkaabm0vwdr5k330.jpg "src=" http:/ S3.51cto.com/wyfs02/m01/53/fe/wkiom1r1g86hljgkaabm0vwdr5k330.jpg "/>

The final result is created later. But there is a need to revise their previous dependencies.


6. Modify the Pom.xml file in Solrcenter-war to add dependencies:



650) this.width=650; "title=" 7.png "style=" Float:none; "alt=" wkiol1r1hfpg8w0zaajulsu78ue979.jpg "src=" http:/ S3.51cto.com/wyfs02/m02/53/fd/wkiol1r1hfpg8w0zaajulsu78ue979.jpg "/>


7. Deploy the Solrcenter-war to Tomcat.
Select Tomcat's add and Remote ....

650) this.width=650; "title=" 8.png "style=" Float:none; "alt=" wkiom1r1g9ljexvsaadhprexhgc916.jpg "src=" http:/ S3.51cto.com/wyfs02/m02/53/fe/wkiom1r1g9ljexvsaadhprexhgc916.jpg "/>





8, the final step if you see if the information:

has been successfully built and deployed!

650) this.width=650; "title=" 9.png "alt=" wkiol1r1hocgqg6oaacsc7rgzry391.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 53/fd/wkiol1r1hocgqg6oaacsc7rgzry391.jpg "/>



This article is from the "Javaweb" blog, make sure to keep this source http://472053211.blog.51cto.com/3692116/1582841

MAVEN builds a multi-module project process under Eclipse. Parent-Child Projects

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.