我正在使用maven程序集插件将所有依赖项打包到lib文件夹中的zip中。 我还使用
添加项目工件<useProjectArtifact>true</useProjectArtifact>
唯一的问题是在最终的zip中我也看到了项目类文件。我想排除它们,因为lib已经包含了工件,但是在尝试了各种选项之后,到目前为止还没有成功。
这是我的assembly.xml
<assembly>
<id>binary</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
答案 0 :(得分:0)
The classes of your project appear in your assembly because your are including them in your assembly with this :
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
So if you don't want your project's classes in your assembly then you have to remove this part from your assembly descriptor.
As a reminder, the variable ${project.build.outputDirectory}
is by default the folder target/classes
.