如何从maven build jar中排除一组包? [英] How to exclude a set of packages from maven build jar?
本文介绍了如何从maven build jar中排除一组包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我所需要的一切。其他细节:我有一个src / bootstrap / java文件夹和常规的src / main / java文件夹。出于显而易见的原因,每个人都需要去一个单独的罐子。我能够使用这个生成一个引导程序jar:
That's all I need. Additional details: I have a src/bootstrap/java folder and the regular src/main/java folder. Each one needs to go to a separate jar for obvious reasons. I was able to generate a bootstrap jar using this:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>only-bootstrap</id>
<goals><goal>jar</goal></goals>
<phase>package</phase>
<configuration>
<classifier>bootstrap</classifier>
<includes>
<include>sun/**/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
但常规jar仍然包含bootstrap类。我正在使用这个答案。
But the regular jar still includes the bootstrap classes. I am compiling the bootstrap classes with this answer.
生成myproject.jar没有引导类的任何灯光?
Any light to generate a myproject.jar WITHOUT the bootstrap classes?
推荐答案
您必须使用default-jar作为ID:
You gotta use "default-jar" for the ID:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>only-bootstrap</id>
<goals><goal>jar</goal></goals>
<phase>package</phase>
<configuration>
<classifier>bootstrap</classifier>
<includes>
<include>sun/**/*</include>
</includes>
</configuration>
</execution>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludes>
<exclude>sun/**/*</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
这篇关于如何从maven build jar中排除一组包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文