maven 程序集依赖项设置为空
我正在尝试设置一个我认为简单的程序集,从多个模块中获取 jar 并将它们放入 zip 内的特定文件夹中。生成的程序集应如下所示:
ir4job\
ir4job\app_lib\
ir4job\app_lib\ jar 文件放在这里
但是当生成程序集时,maven 给了我一个空的 zip 文件 程序
集描述符:
<assembly>
<!-- ir4job folder contents -->
<id>ir4job-app</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<binaries>
<dependencySets>
<dependencySet>
<outputDirectory>ir4job/app_lib</outputDirectory>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
pom 文件:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>glb</groupId>
<artifactId>Release</artifactId>
<packaging>pom</packaging>
<name>release</name>
<version>1.0</version>
<parent>
.... parent info ....
</parent>
<dependencies>
... various dependencies ...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>ir4job-app.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>do-release</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我很确定我在这里错过了一些简单的东西...它是什么?
Im trying to setup what I think is a simple assembly, taking the jars from several modules and putting them in a specific folder inside a zip. The resulting assembly should look like so:
ir4job\
ir4job\app_lib\
ir4job\app_lib\ jar files go here
But maven is giving me an empty zip file when the assembly is generated
Assembly descriptor:
<assembly>
<!-- ir4job folder contents -->
<id>ir4job-app</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<binaries>
<dependencySets>
<dependencySet>
<outputDirectory>ir4job/app_lib</outputDirectory>
</dependencySet>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
pom file:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>glb</groupId>
<artifactId>Release</artifactId>
<packaging>pom</packaging>
<name>release</name>
<version>1.0</version>
<parent>
.... parent info ....
</parent>
<dependencies>
... various dependencies ...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>ir4job-app.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>do-release</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Im pretty sure I missed something simple here... what is it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
乍一看,您似乎缺少要包含的文件集。例如:
您需要为要包含的每个目录提供一个文件集(除非它们位于同一父目录下)。其语法类似于:
edit #1:
使用 maven-dependency-plugin 将依赖项复制到文件夹的工作示例:
注意:您还可以使用配置选项来限制复制的依赖项,例如
You can also limit by artifactId、分类器等
编辑#2:
解决方案
更好的答案可能只是将您的 dependencySet 标记拉高几个级别,如下所示:
At first glance, it seems you are missing the filesets to include. For example:
You will need a fileset for each directory you want to include (unless they fall under the same parent directory). The syntax for that is something like:
edit #1:
Working example of using the maven-dependency-plugin to copy dependencies to a folder:
Note: you can also limit the dependencies that get copied using configuration options such as
You can also limit by artifactId, classifier, etc.
edit #2:
Solution
The better answer is probably just to pull your dependencySet tag up a couple levels as in: