【发布时间】:2011-12-17 14:18:15
【问题描述】:
我正在使用 maven(最新)构建一个简单的 Jar 项目
运行 maven package 时,我正确获取了目标目录下的 jar 文件,
我想自定义输出,以便 maven 将一些文件和依赖项复制到 jar 旁边的目标中。
当前文件夹结构为:
/
-- resources
-- src/main/java/com..(project sources)
-- src/main/assembly (location of the assebmly.xml)
想要的目标目录结构是:
target
|
-- myJar1.0.jar (the artiface)
-- resources (from the root build folder)
-- lib (all the dependancies)
|
-- anotherJar-1.0.jar
-- anotherJar2-1.0.jar
-- anotherJar3-1.0.jar
我在 apache 网站上阅读了custom assembly,
我将配置添加到 maven-assembly-plugin 并配置了 assembly.xml
但我必须做错事,我没有得到正确的输出,
这里是 assembly.xml
<assembly>
<id/>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target</directory>
<outputDirectory>/lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>resources</directory>
<outputDirectory>/resources</outputDirectory>
<includes>
<include>*.*</include>
</includes>
</fileSet>
</fileSets>
目标目录包含具有依赖关系的库,但它位于具有工件名称的文件夹中, 资源目录根本没有被复制。
请指教 谢谢
【问题讨论】: