war项目分别打成JAR和WAR,并被其他项目依赖
来源:互联网 发布:众力网络安装电话 编辑:程序博客网 时间:2024/06/11 20:00
参考:http://blog.csdn.net/kobejayandy/article/details/8143925
http://www.tuicool.com/articles/eMJNza
<1>被依赖的war项目分别打成JAR和war:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
<configuration>
<includes>
<include>com/**</include>
</includes>
</configuration>
<executions>
<execution>
<id>make-a-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>api</classifier>
</configuration>
</execution>
</executions>
</plugin>
<2>引入jar和war包
<!--引入基础war包 -->
<dependency>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
<version>${hnjz.basic.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
<version>${hnjz.basic.version}</version>
<type>jar</type>
<scope>compile</scope>
<classifier>api</classifier>
</dependency>
<3>配置两个war包内容合并
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<!--依赖的war项目,默认在target/war/work中,然后被打包进war文件,指定后为target/work -->
<workDirectory>${project.build.directory}/work</workDirectory>
<!-- 告诉maven-war-plugin另一个路径"WebContent",产生的结果就是,执行mvn package时,war-plugin和warpath-plugin会将当前war和所有依赖的war的web资源都拷贝到该WebContent目录下.这样,WebContent目录包含的内容就是最终打包成WAR的内容了 ,如果不指定,默认情况下是在 target目录下生成一个,war包解压后的文件夹-->
<!-- <webappDirectory>WebContent</webappDirectory> -->
<useCache>false</useCache>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
<overlays>
<overlay>
<groupId>com.hnjz</groupId>
<artifactId>hnjz-web-basic</artifactId>
</overlay>
<overlay>
<!-- empty groupId/artifactId is detected as the current build -->
<!-- 代表当前WAR项目,默认情况当前WAR项目是先被拷贝,如果要控制其顺序,则使用空的overlay -->
<!-- any other overlay will be applied after the current build since
they have not been configured in the overlays element -->
</overlay>
</overlays>
<!-- 排除依赖war包中的哪些文件
<dependentWarExcludes>*/web.xml,WEB-INF/lib/*,/sql-map-config.xml,/jdbc.properties,/META-INF/*</dependentWarExcludes>
-->
<dependentWarExcludes>/META-INF/*</dependentWarExcludes>
</configuration>
</plugin>
0 0
- war项目分别打成JAR和WAR,并被其他项目依赖
- SpringBoot项目打成war和jar
- Maven项目中依赖其他工程(打成war包)
- 将项目打成war包
- 把web项目打成war
- 将项目打成war包
- 使用jar命令,将web项目打成war
- Maven中如何配置WAR依赖WAR和JAR的多模块项目结构
- Maven中如何配置WAR依赖WAR和JAR的多模块项目结构
- 【Maven】项目打包-war包-Jar包[IDEA将项目打成war包]
- 把辅助类达成jar包,和把项目打成war包
- tomcat将项目打成war包和tomcat账户管理
- 将Java Web项目打成war文件
- java 环境变量 以及把项目打成WAR
- 把java项目打成war包
- 用eclipse将项目打成war包
- IDEA将web项目打成war包
- Eclipse如何将项目打成war吧
- Poker Card Lucky Draw by iBET
- HorizantalScrollView配合ScrollView使用
- 20170301
- __gcd
- #1 TwoSum_leetcode
- war项目分别打成JAR和WAR,并被其他项目依赖
- SSL1222 矩形(并查集)
- 利用jQuery给表格添加分页效果
- 暗号编辑【代码056852】
- Create a mosaic out of several input videos
- linux下使用 du查看某个文件或目录占用磁盘空间的大小方法
- 关于OkHttp缓存post请求的问题
- lx007菲波那切数列(使用递归)
- 跟小博老师一起学JSP ——简介与工作原理