我有非常简单的汇编描述符
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<formats>
<format>jar</format>
</formats>
<!-- copied from jar-with-dependencies -->
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<exclude>**/dbAccess.*</exclude>
</excludes>
</fileSet>
</fileSets>
主要是从Maven Descriptor Refs复制的。但是我组装的jar仍然包含dbAccess。*文件。我尝试了各种配置进行排除。
调试输出只是:
[DEBUG] The archive base directory is 'null'
[DEBUG] NOT reformatting any files in /media/truecrypt1/Development/workspace_java/baseanalysis/target/classes
[DEBUG] Adding file-set from directory: '/media/truecrypt1/Development/workspace_java/baseanalysis/target/classes'
assembly output directory is: ''
[DEBUG] Adding file-set in: /media/truecrypt1/Development/workspace_java/baseanalysis/target/classes to archive location:
如果我把它放在pom的构建部分中,那么正常的resouces过滤就可以了。
答案 0 :(得分:12)
您还需要过滤dependencySet
。
尝试将程序集描述符更新为
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<unpackOptions>
<excludes>
<exclude>**/dbAccess.*</exclude>
</excludes>
</unpackOptions>
</dependencySet>