首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Maven多项目倚赖配置

2013-11-06 
Maven多项目依赖配置modelVersion4.0.0/modelVersiongroupIdcn.jess.platform/groupIdartifactId

Maven多项目依赖配置
<modelVersion>4.0.0</modelVersion> <groupId>cn.jess.platform</groupId> <artifactId>aggregator</artifactId> <version>0.0.1-SNAPSHOT</version><!-- 因为是父工程 ,因此此处的packaging必须为pom --> <packaging>pom</packaging> <name>aggregator</name> <modules> <module>../open-platform-common</module> <module>../open-platform-web</module> <module>../open-bug-m</module> </modules> <!-- 配置部署的远程仓库 --> <distributionManagement> <snapshotRepository> <id>nexus-snapshots</id> <name>nexus distribution snapshot repository</name> <url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <encoding>UTF-8</encoding> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </pluginManagement> </build> <dependencyManagement> <dependencies> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.6.0</version> <scope>system</scope> <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath> </dependency> </dependencies> </dependencyManagement>

<!-- 由于存在parent工程,因此groupId和version可以省略,直接使用parent工程--> <modelVersion>4.0.0</modelVersion> <artifactId>open-platform-common</artifactId> <!-- 因为此工程要发布到webapp的lib目录下,因此为jar(不知道这样解释对否?) --> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <!-- 指定Maven仓库 --><repositories><!-- my的maven仓库 --><repository><id>myRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories> <!-- 指定maven plugin仓库 --><pluginRepositories><!-- oschina的maven plugin仓库 --><pluginRepository><id>myPluginRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories> <dependencies> <!-- 此处的类库根据自己的需要进行添加 --> </dependencies> <!-- 用来指定父工程--> <parent> <groupId>cn.jess.platform</groupId> <artifactId>aggregator</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../aggregator</relativePath> </parent>

<!-- 由于存在parent工程,因此groupId和version可以省略,直接使用parent工程--> <modelVersion>4.0.0</modelVersion> <artifactId>open-platform-web</artifactId><!-- 因为此工程要发布到webapp应用的根目录下,因此为war(不知道这样解释对否?) --> <packaging>war<ng> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <!-- 指定Maven仓库 --><repositories><!-- my的maven仓库 --><repository><id>myRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories> <!-- 指定maven plugin仓库 --><pluginRepositories><!-- oschina的maven plugin仓库 --><pluginRepository><id>myPluginRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories> <parent> <groupId>cn.jess.platform</groupId> <artifactId>aggregator</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../aggregator</relativePath> </parent></project>

? ??注意:此工程的WEB-INF目录下必须包含web.xml文件,否则在执行mvn时会报错

<groupId>open-bug-m</groupId> <artifactId>open-bug-m</artifactId> <packaging>war</packaging> <name/> <description/> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <parent> <groupId>cn.jess.platform</groupId> <artifactId>aggregator</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../aggregator</relativePath> </parent> <!-- 指定Maven仓库 --><repositories><!-- my的maven仓库 --><repository><id>myRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories> <!-- 指定maven plugin仓库 --><pluginRepositories><!-- oschina的maven plugin仓库 --><pluginRepository><id>myPluginRepository</id><name>local private nexus</name><url>http://127.0.0.1:8081/nexus/content/groups/public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>false</enabled></snapshots></pluginRepository></pluginRepositories> <dependencies> <dependency> <groupId>cn.jess.platform</groupId> <artifactId>open-platform-common</artifactId> <version>0.0.1-SNAPSHOT</version> <type>jar</type> </dependency> <dependency> <groupId>cn.jess.platform</groupId> <artifactId>open-platform-web</artifactId> <version>0.0.1-SNAPSHOT</version> <type>war</type> </dependency> <!-- 此处的类库根据自己的需要进行添加 --> </dependencies> <build> <finalName>open-bug</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <packagingExcludes>WEB-INF/web.xml</packagingExcludes> <overlays> <overlay> <groupId>cn.jess.platform</groupId> <artifactId>open-platform-web</artifactId> </overlay> </overlays> </configuration> </plugin> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.2.3</version> <configuration> <container> <containerId>tomcat7x</containerId> <home>F:\apache-tomcat-7.0.42(x64)</home> </container> <configuration> <type>existing</type> <home>F:\apache-tomcat-7.0.42(x64)</home> <properties> <cargo.jvmargs> -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787 </cargo.jvmargs> </properties> </configuration> </configuration> <executions> <execution> <id>cargo-run</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

?

热点排行