mvn 父工程

1、创建一个父工程的pom文件

<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">
<parent>
<groupId>com.sohu</groupId>
<artifactId>focus-root-pom</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cn.focus.dc.app.stat</groupId>
<artifactId>foucs-app-report</artifactId>
<packaging>pom</packaging>
<name>foucs-app-report</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<modules>
<module>foucs-app-report-dao</module>
<module>foucs-app-report-model</module>
<module>foucs-app-report-service</module>
<module>foucs-app-report-web</module>
</modules>

<dependencies>
<dependency>
<groupId>net.paoding</groupId>
<artifactId>paoding-rose</artifactId>
</dependency>
<dependency>
<groupId>net.paoding</groupId>
<artifactId>paoding-rose-jade</artifactId>
</dependency>
<dependency>
<groupId>net.paoding</groupId>
<artifactId>paoding-rose-portal</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</dependency>
<dependency>
<groupId>commons-jexl</groupId>
<artifactId>commons-jexl</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.sohu.sce</groupId>
<artifactId>focus-sso-client</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
</dependency>
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>cn.focus.dc</groupId>
<artifactId>remote-logging-log4j</artifactId>
</dependency>
<dependency>
<groupId>cn.focus.dc.cms.auth</groupId>
<artifactId>cms-auth-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.focus.dc.commons</groupId>
<artifactId>sce-memcached-support</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
</dependency>
<!-- 邮件发送的依赖包 -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
<!-- sce邮件发送的依赖包 -->
<dependency>
<groupId>com.sohu.apps.api</groupId>
<artifactId>sce_sdk4j</artifactId>
</dependency>

</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.6</targetJdk>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</reporting>
</project>



2、在父工程下创建子工程的module


<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.focus.dc.app.stat</groupId>
<artifactId>foucs-app-report</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>focus-app-report-model</artifactId>
<packaging>jar</packaging>
<name>focus-app-report-model</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>



3、web的pom文件

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.focus.dc.app.stat</groupId>
<artifactId>foucs-app-report</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>focus-app-report-web</artifactId>
<packaging>war</packaging>

<dependencies>
<dependency>
<groupId>cn.focus.dc.app.stat</groupId>
<artifactId>focus-app-report-service</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<verbose>true</verbose>
<encoding>UTF-8</encoding>
<compilerArguments>
<sourcepath>${project.basedir}/src/main/java</sourcepath>
<sourcepath>${project.basedir}/src/main/resources</sourcepath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Rose>*</Rose>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<!-- <archiveClasses>true</archiveClasses> -->
<webappDirectory>${war.webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.11.v20130520</version>
<configuration>
<systemProperties>
<systemProperty>
<name>DEBUG</name>
<value>TRUE</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>5</scanIntervalSeconds>
<stopKey>focus</stopKey>
<stopPort>9999</stopPort>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<excludes>
<exclude>**/*.jsp</exclude>
</excludes>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.codegen</groupId>
<artifactId>maven-jadegen-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<!-- 默认值 是 com.mysql.jdbc.Driver, 可根据需要确定是否修改数据库配置信息 -->
<driverClass>com.mysql.jdbc.Driver</driverClass>
<dbUrl>jdbc:mysql://10.10.90.156:3306/pinge</dbUrl>

<dbUser>*****</dbUser>
<dbPassword>*****</dbPassword>

<!-- 数据库表名,根据需要进行修改,默认是 % 全部, 支持前缀形式 比如:user_%;如果是散表,随意取 一个散表的表名如test_04及可生成散表格式的DAO -->

<tbNamePattern>pic_favorite_log</tbNamePattern>

<!-- 生成的DAO和Model的包路径,注:包要事先建好,否则执行时可能报错 -->
<modelPkg>cn.focus.dc.app.pinge.model</modelPkg>
<daoPkg>cn.focus.dc.app.pinge.dao</daoPkg>

<!-- 默认是 工程 src/main/java 目录 -->
<srcFolder>${project.build.sourceDirectory}</srcFolder>

<!-- 基础类的设置 -->
<baseObjectClass>cn.focus.dc.commons.model.BaseObject</baseObjectClass>
<pkClass>cn.focus.dc.commons.annotation.PrimaryKey</pkClass>
</configuration>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptors>
<descriptor>src/main/assemble/package.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</reporting>
</project>



1.<archiveClasses>false
src/main/resources是默认的资源目录。
当archiveClasses=true时,resources中的文件资源会被打到jar中;
当archiveClasses=false时,resources中的文件资源在war的根目录。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值