[英]Jar with compiled class files in different directories with Maven
I have a java project with multiple source directories. 我有一个包含多个源目录的java项目。 I use the build-helper-maven-plugin to compile them.
我使用build-helper-maven-plugin来编译它们。 Layout as follows:
布局如下:
project
|
|-src-
| |-com/example1-
| |-Test.java
|
|-src2
| |-META-INF
| |-classes
| | |-com/example2
| | |-Test2.java
| |
| |-Manifest.mf
|
|-MavenDependencies
For reasons I care not to explain right now, I need to produce a jar file looking something like this. 由于我不想立即解释的原因,我需要生成一个类似于此的jar文件。
jar-
|-com/example1-
| |-Test.java
|
|-META-INF
|-classes
| |-com/example2
| |-Test2.java
|
|-Manifest.mf
|
|-lib
I know there must some plugin that can be used to achieve this, just can't seem to find it. 我知道必须有一些插件可以用来实现这一点,似乎无法找到它。
I believe you are looking for the "Maven Assembly Plugin": http://maven.apache.org/plugins/maven-assembly-plugin/ 我相信你正在寻找“Maven Assembly Plugin”: http : //maven.apache.org/plugins/maven-assembly-plugin/
Since it seems you are building a non-standard jar, the assembly plugin will allow you to put whichever files you want wherever you want them to go. 由于您似乎正在构建一个非标准的jar,因此程序集插件允许您将所需的任何文件放在任何您想要的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.