【发布时间】:2020-06-18 09:46:18
【问题描述】:
我使用 maven-assembly-plugin 3.1.1 版制作了一个包含所有依赖项的 jar。 我想排除我的 application.yml 但是我无法从 jar 中删除它。
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<descriptors>
<descriptor>env/assembly/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我的描述符.xml:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>test</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>compile</scope>
<excludes>
<exclude>
application.yml
</exclude>
</excludes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<outputDirectory>/</outputDirectory>
<directory>${project.build.outputDirectory}</directory>
<excludes>
<exclude>
application.yml
</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
结果:
The following patterns were never triggered in this artifact exclusion filter:
o 'application.yml'
如果我使用 * 模式而不是 application.yml,则所有文件都将被很好地删除。
我试图放置绝对路径,但它没有任何改变:
<excludes>
<exclude>
env/dev/conf/application.yml
</exclude>
</excludes>
我的 fileSets 中的 exclude 接缝也没用。
还在 fileSets 和 dependencySet 中尝试过这种模式,但 application.yml 仍然包含:
<exclude>
**/application.yml
</exclude>
【问题讨论】:
-
注意这里使用的模式是ant-pattern:ant.apache.org/manual/dirtasks.html你在fileSet exclude中试过**/application.yml吗?
-
@DrHopfen 我也绑定了 **/application.yml 但它仍然包含。
标签: maven jar maven-assembly-plugin