转载地址:http://blog.csdn.net/stormragewang/article/details/43407471
这样就可以将自己的jar包部署到私有库中了,将maven工程的SNAPSHO后缀删除后自动发布到Release属性的仓库,之前默认的是Snapshot属性的仓库。
1 <build> 2 <finalName>${project.artifactId}</finalName> 3 <plugins> 4 <plugin> 5 <artifactId>maven-source-plugin</artifactId> 6 <version>2.2.1</version> 7 <executions> 8 <execution> 9 <id>attach-sources</id> 10 <phase>verify</phase> 11 <goals> 12 <goal>jar-no-fork</goal> 13 </goals> 14 </execution> 15 </executions> 16 </plugin> 17 </plugins> 18 </build>
再部署时,就会自动上传源码包了
1 <plugins> 2 <plugin> 3 <groupId>org.codehaus.cargo</groupId> 4 <artifactId>cargo-maven2-plugin</artifactId> 5 <version>1.1.3</version> 6 <extensions>true</extensions> 7 <configuration> 8 <descriptor>src/assemble/merge.xml</descriptor> 9 </configuration> 10 </plugin> 11 </plugins>
2、配置文件src/assemble/merge.xml配置如下
1 <?xml version="1.0" encoding="UTF-8"?> 2 <uberwar> 3 <wars> 4 <war>com.hust.wnlo.dsis.ipackaging:user.web</war> 5 <war>com.hust.wnlo.dsis.ipackaging:commodity.web</war> 6 </wars> 7 <webXml> 8 <contextParams> 9 <strategy name="ChooseByName"> 10 <default> 11 <strategy name="Preserve" /> 12 </default> 13 <choice name="contextConfigLocation"> 14 <strategy name="NodeMerge"> 15 <context-param> 16 <param-name>$left:param-name</param-name> 17 <param-value>$left:param-value $right:param-value</param-value> 18 </context-param> 19 </strategy> 20 </choice> 21 </strategy> 22 </contextParams> 23 </webXml> 24 </uberwar>
3、使用cargo:uberwar合并这2个war包 输出日志如下 1 [INFO] Scanning for projects... 2 [INFO] 3 [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 4 [INFO] 5 [INFO] ------------------------------------------------------------------------ 6 [INFO] Building all Maven Webapp 0.0.1-SNAPSHOT 7 [INFO] ------------------------------------------------------------------------ 8 [INFO] 9 [INFO] --- cargo-maven2-plugin:1.1.3:uberwar (default-cli) @ all --- 10 [INFO] Building war: D:\TestWork\workspace\com.hust.wnlo.dsis.ipackaging.all-0.0.1-SNAPSHOT\target\all.war 11 [INFO] ------------------------------------------------------------------------ 12 [INFO] BUILD SUCCESS 13 [INFO] ------------------------------------------------------------------------ 14 [INFO] Total time: 6.426 s 15 [INFO] Finished at: 2015-02-02T14:42:54+08:00 16 [INFO] Final Memory: 8M/166M 17 [INFO] ------------------------------------------------------------------------
转载于:https://www.cnblogs.com/yanduanduan/p/6588197.html