多工程Maven工程的创建
来源:互联网 发布:零基础学大数据算法pdf 编辑:程序博客网 时间:2024/05/13 05:33
1、创建顶层的mvn工程的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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Centrepoint</name>
<groupId>com.effectivemaven.centrepoint</groupId>
<artifactId>centrepoint</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<description>
Centrepoint is a basic but useful application that sets up a
dashboard of project information from Maven, Archiva and
Continuum.
</description>
</project>
2 假设我们要创建的工程包括3个模块 module-one,module-two,module-three
依次执行下面的语句
mvn archetype:generate -DartifactId=module-one -DgroupId=com.maventest.parent
mvn archetype:generate -DartifactId=module-two -DgroupId=com.maventest.parent
mvn archetype:generate -DartifactId=module-three -DgroupId=com.maventest.parent
3 执行完成之后 mvn eclipse:eclipse 导入工程就会得到3个工程
4 查看主pom.xml 可以看到已经变成
<?xml version="1.0" encoding="UTF-8"?>
<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>
<name>parent</name>
<groupId>com.maventest.parent</groupId>
<artifactId>projectMain</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<description>
This is main parent project.
</description>
<modules>
<module>module-one</module>
<module>module-two</module>
<module>module-three</module>
<module>module-web</module>
</modules>
</project>
5 增加本地repository
<repositories>
<repository>
<id>holly-thinkpad-releases</id>
<name>holly-thinkpad-releases</name>
<url>http://localhost:8081/artifactory/repo</url>
</repository>
</repositories>
6 增加dependencies
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.maven.artifact.version}</version>
</dependency>
</dependencies>
7 增加resource 文件路径
<build>
<resources>
<!-- standard Maven folder -->
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- plus root folder -->
<resource>
<directory>.</directory>
<includes>
<include>plugin.xml</include>
<include>META-INF/*</include>
</includes>
</resource>
</resources>
</build>
<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>
<name>Centrepoint</name>
<groupId>com.effectivemaven.centrepoint</groupId>
<artifactId>centrepoint</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<description>
Centrepoint is a basic but useful application that sets up a
dashboard of project information from Maven, Archiva and
Continuum.
</description>
</project>
2 假设我们要创建的工程包括3个模块 module-one,module-two,module-three
依次执行下面的语句
mvn archetype:generate -DartifactId=module-one -DgroupId=com.maventest.parent
mvn archetype:generate -DartifactId=module-two -DgroupId=com.maventest.parent
mvn archetype:generate -DartifactId=module-three -DgroupId=com.maventest.parent
3 执行完成之后 mvn eclipse:eclipse 导入工程就会得到3个工程
4 查看主pom.xml 可以看到已经变成
<?xml version="1.0" encoding="UTF-8"?>
<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>
<name>parent</name>
<groupId>com.maventest.parent</groupId>
<artifactId>projectMain</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<description>
This is main parent project.
</description>
<modules>
<module>module-one</module>
<module>module-two</module>
<module>module-three</module>
<module>module-web</module>
</modules>
</project>
5 增加本地repository
<repositories>
<repository>
<id>holly-thinkpad-releases</id>
<name>holly-thinkpad-releases</name>
<url>http://localhost:8081/artifactory/repo</url>
</repository>
</repositories>
6 增加dependencies
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.maven.artifact.version}</version>
</dependency>
</dependencies>
7 增加resource 文件路径
<build>
<resources>
<!-- standard Maven folder -->
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- plus root folder -->
<resource>
<directory>.</directory>
<includes>
<include>plugin.xml</include>
<include>META-INF/*</include>
</includes>
</resource>
</resources>
</build>
- 多工程Maven工程的创建
- 多工程Maven工程的创建
- maven工程的创建
- Maven工程的创建
- Maven工程的创建
- Maven archetype 工程的创建
- maven创建多模块工程
- 创建多模块maven工程
- maven创建多模块工程
- 创建maven工程
- 使用maven创建工程
- maven创建工程
- maven 创建工程
- 创建maven web 工程
- maven 创建springMVC工程
- MyEclipse创建Maven工程
- Maven 创建springmvc工程
- MyEclipse创建Maven工程
- MFC中动态创建N级菜单以及响应事件
- Common下StringHelper.cs
- 程序开发规范
- 我使用过的Linux命令之dot - 绘制DOT语言脚本描述的图形
- 数据库中字段的转换(varchar转换成datetime)
- 多工程Maven工程的创建
- Android中ExpandableListView控件基本使用
- 对字符串倒过来输出的几种处理方法。
- WdatePicker 使用说明
- unsupported major.miniorversion 49.0
- 数据结构
- guide设计图形用户界面,处理图像
- Eclipse插件安装
- 升级日志_20120222_maximo7118 包打包成功