gpt4 book ai didi

maven - 使用 Maven 程序集排除文件不起作用

转载 作者:行者123 更新时间:2023-12-02 10:58:45 25 4
gpt4 key购买 nike

我有非常简单的程序集描述符

<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.* 文件。我尝试了各种排除配置。

  • 更改的目录:..build.directory}/classes
  • 更改了排除模式:dbAccess.*、**/*.properties、**/*

调试输出只是:

[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 的构建部分中,则正常的资源过滤将起作用。

最佳答案

您还需要过滤dependencySet。尝试将程序集描述符更新为

<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<unpackOptions>
<excludes>
<exclude>**/dbAccess.*</exclude>
</excludes>
</unpackOptions>
</dependencySet>

关于maven - 使用 Maven 程序集排除文件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14337930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com