java要多思考下

成长^_^

   ::  :: 新随笔 ::  ::  :: 管理 ::
  33 随笔 :: 0 文章 :: 19 评论 :: 0 Trackbacks
1、多个依赖项目(以common,sso为例)存放于同级目录下(这个目录暂称为顶级目录)
2、在顶级目录中创建sso-pom.xml,sso-pom-dev.xml,sso-pom-test.xml
2.1、编写sso-pom.xml,sso-pom-dev.xml,sso-pom-test.xml如下:
 1         公共配置:
 2         <artifactId>sso</artifactId>
 3         <groupId>com.xxx.sso</groupId>
 4         <version>3.2.0-SNAPSHOT</version>
 5         <packaging>pom</packaging>
 6         
 7         不同配置:
 8         sso-pom.xml:
 9         <modules>
10             <module>cdcommon/trunk/pom.xml</module>    
11             <module>sso/trunk/pom.xml</module>
12         </modules>
13 
14         sso-pom-dev.xml:
15         <modules>
16             <module>cdcommon/trunk/pom-dev.xml</module>    
17             <module>sso/trunk/pom-dev.xml</module>
18         </modules>
19 
20         sso-pom-test.xml:
21         <modules>
22             <module>cdcommon/trunk/pom-test.xml</module>    
23             <module>sso/trunk/pom-test.xml</module>
24         </modules>

3、每个项目(common,sso)目录中创建一个pom.xml,pom-dev.xml,pom-test.xml

3.1、编写pom.xml,pom-dev.xml,pom-test.xml,替换不同环境下的配置文件

 1 <properties>
 2             <buildDirectory>e:/mvn_out/cdcommon</buildDirectory>
 3             <sourceDirectory>src/main/java</sourceDirectory>
 4             <fileName>common-1.0</fileName>
 5             <commonProperties>src/main/resources/config/common-dev.properties</commonProperties>
 6         </properties>
 7 
 8         <plugins>
 9             <plugin>
10             <groupId>org.apache.maven.plugins</groupId>
11             <artifactId>maven-antrun-plugin</artifactId>
12             <version>1.6</version>
13             <executions>
14               <execution>
15                 <id>compile</id>
16                 <phase>compile</phase>
17                 <configuration>
18                   <target>
19                         <echo message="********************** copy profile common.properties file *************************"/>                                                                                                                                                                                    
20                         <copy file="${commonProperties}"
21                               tofile="${buildDirectory}/classes/common.properties" overwrite="true"/>
22                   </target>
23                 </configuration>
24                 <goals>
25                   <goal>run</goal>
26                 </goals>
27               </execution>
28             </executions>
29             </plugin>
30         <plugins>
4、运行命令,打包不同环境下的发布版本
        生产:mvn package -f sso-pom.xml
        开发:mvn package -f sso-pom-dev.xml
        测试:mvn package -f sso-pom-test.xml

 
posted on 2012-10-30 11:29 java要多思考下 阅读(5084) 评论(0)  编辑  收藏 所属分类: 研发管理

只有注册用户登录后才能发表评论。


网站导航: