Maven with Multi-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 is an ERROR!!!!

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

 

en, you should go to the derictory "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>
        <hibernate.core.version>3.6.10.Final</hibernate.core.version>
        <javassist.version>3.18.1-GA</javassist.version>
        <mysql.connector.version>5.1.33</mysql.connector.version>
        <log4j.version>1.2.17</log4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Configuration for Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.core.version}</version>
        </dependency>
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>${javassist.version}</version>
        </dependency>
        <!-- Configuration for mysql -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.connector.version}</version>
        </dependency>
        <!-- Configuration for log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
    </dependencies>
</project>

/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 : https://files.cnblogs.com/hongten/hongten-sesurity.rar

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

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

More reading,and english is important.

I'm Hongten

 

大哥哥大姐姐,觉得有用打赏点哦!多多少少没关系,一分也是对我的支持和鼓励。谢谢。
Hongten博客排名在100名以内。粉丝过千。
Hongten出品,必是精品。

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

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

 

posted @ 2014-11-02 16:51  Hongten  阅读(1796)  评论(0编辑  收藏  举报
Fork me on GitHub