Maven的分类空瓶 [英] Maven classifier empty jars
本文介绍了Maven的分类空瓶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我们有多模块Maven项目:
Assume we have multimodule maven project:
parent
|-module-a-jar
|-module-b-jar
|-web-module-c-war
有常见划为父pom.xml的规定:
There is common classified specified for parent pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<classifier>${my.project.classifier}</classifier>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<classifier>${my.project.classifier}</classifier>
</configuration>
</plugin>
</plugins>
</pluginManagement>
假设我建的项目中使用
Assume that I build project using
mvn clean package -Dmy.project.classifier=NIGHTLY
建立后的 Web模块-C-战争包含空文件夹,而不是jar文件:
After building web-module-c-war contains empty folders instead of jar files:
web-module-c-war
|-WEB-INF
|-lib
|-module-a-jar
|-module-a-jar
你能请告知如何解决这一问题?为什么会这样?
Can you please advise how to fix this? Why this is happening?
如果我删除分类从Maven的JAR-plugin配置它似乎是工作的罚款。
If I remove classifier from maven-jar-plugin configuration it seems to be working fine.
感谢
推荐答案
为什么不使这个?
-
POM Web模块-C-战争:
pom web-module-c-war :
<groupId>xxxxx</groupId>
<artifactId>xxxx</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>${my.project.classifier}</classifier>
..
..
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module-a-jar</artifactId>
<version>${project.version}</version>
<classifier>${my.project.classifier}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>module-b-jar</artifactId>
<version>${project.version}</version>
<classifier>${my.project.classifier}</classifier>
</dependency>
这篇关于Maven的分类空瓶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文