首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Maven with Multi-module

Maven with Multi-module

作者头像
Hongten
发布2018-09-13 10:57:12
4410
发布2018-09-13 10:57:12
举报
文章被收录于专栏:HongtenHongtenHongten

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

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

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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2014-11-02 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档