Maven with Multi-module, mavenmulti-module

Source: Internet
Author: User

Maven with Multi-module, mavenmulti-module

Well, A project made of multi modules.

For example, the hongten-security project, the structure of the hongten-security project display as below (In eclipse tool ):

And in the windows 7 operating system, the folder structure of the hongten-security project display as below,

Then, you have TWO choices to run (or install) this project to you local liberary (repository ).

The first one:

Back to eclipse tool, select the "Package explorer" window, and select the "/hongten-sesurity/pom. xml" to run (or install) this project.

The second:

Back to Window 7 operating system, go to the directory "D: \ Development \ j2ee \ workspace \ hongten-sesurity", and open the command window to run (or install) this project.

 

I will display with the second method, and type the command"Mvn install"In the command window.

WOW, there isERROR!!!!

The Maven canNOTFind the parent. relativePath, it means that the "security-parent" model must install before you run (or install) the "hongten-security" project.

 

En, you shoshould go to the dericloud "D: \ Development \ j2ee \ workspace \ hongten-sesurity \ security-parent" to install "security-parent" model.

After installing the "security-parent" model, rember to back to parent folder ("D: \ Development \ j2ee \ workspace \ hongten-sesurity ")

And type the command"Mvn install"

========================================================== ====

Source Code

========================================================== ====

/Hongten-sesurity/pom. xml

<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/xsd/maven-4.0.0.xsd">  <modelVersion>4.0.0</modelVersion>  <groupId>com.b510.hongten</groupId>  <artifactId>hongten-sesurity</artifactId>  <version>0.0.1</version>  <packaging>pom</packaging>  <name>hongten-sesurity</name>  <url>http://maven.apache.org</url>    <modules>      <module>security-parent</module>      <module>security-configuration</module>      <module>security-model</module>      <module>security-web</module>  </modules></project>

/Security-configuration/pom. xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.b510.hongten</groupId>        <artifactId>security-parent</artifactId>        <version>0.0.1</version>    </parent>    <artifactId>security-configuration</artifactId>    <name>security-configuration</name>    <packaging>jar</packaging></project>

/Security-model/pom. xml

<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/xsd/maven-4.0.0.xsd">  <modelVersion>4.0.0</modelVersion>   <parent>      <groupId>com.b510.hongten</groupId>      <artifactId>security-parent</artifactId>      <version>0.0.1</version>  </parent>  <artifactId>security-model</artifactId>  <name>security-model</name>  <packaging>pom</packaging>  <modules>      <module>security-model-ai</module>      <module>security-model-xml</module>  </modules></project>

/Security-model-ai/pom. xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.b510.hongten</groupId>        <artifactId>security-model</artifactId>        <version>0.0.1</version>    </parent>    <artifactId>security-model-ai</artifactId>    <name>security-model-ai</name>    <packaging>jar</packaging></project>

/Security-model-xml/pom. xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.b510.hongten</groupId>        <artifactId>security-model</artifactId>        <version>0.0.1</version>    </parent>    <artifactId>security-model-xml</artifactId>    <name>security-model-xml</name>    <packaging>jar</packaging></project>

/Security-parent/pom. xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <!-- security-parent -->    <groupId>com.b510.hongten</groupId>    <artifactId>security-parent</artifactId>    <version>0.0.1</version>    <packaging>pom</packaging>    <name>security-parent</name>    <url>http://maven.apache.org</url>    <!-- All properties declare here -->    <properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <junit.version>4.10</junit.version>        

/Security-web/pom. xml

<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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.b510.hongten</groupId>        <artifactId>security-parent</artifactId>        <version>0.0.1</version>    </parent>    <artifactId>security-web</artifactId>    <name>security-web</name>    <packaging>jar</packaging></project>

 

Source Code Download:Http://files.cnblogs.com/hongten/hongten-sesurity.rar

Source Code Download:Http://files.cnblogs.com/hongten/hongten-sesurity_with_dependencyManagement.rar

========================================================== ======================

More reading, and english is important.

I'm Hongten

 

E | hongtenzone@foxmail.com B | http://www.cnblogs.com/hongten

========================================================== ======================

 


What does Maven in Maven with MyEclipse Projects mean?

A development tool, plug-in, or theoretical method.
From the original use of notepad to the use of advanced tools such as myeclipse, it is an improvement.
People are always very lazy and don't want to repeat things. repetitive things are handed over to tools. Like ant, ant can identify scripts and describe what you want to do in script form to the script file, so ant can help you execute (including copying and packaging files, rename and other operations that usually need to be clicked with the mouse can be written as scripts), and the bat batch processing in windows is exhausted.

Maven is also one of these things. It is used for project management and can be used to manage large-scale project development. It is almost unnecessary for beginners.

Why can't I find the Jar packages of other Maven modules when I create the Maven Module compile?

I don't quite understand your project structure. From my understanding, do you write the user-core dependency in the pom. xml of the user-dao module, that is, the dependency tag?

If it is written, you need to first mvn install user-core

Of course, the mvn install user-core must be correctly executed !! This is important!

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.