我有一个maven项目,生成一个jar,而不是附加maven-assembly的appendAssemblyId。
如何让maven停止发出警告:“配置选项'appendAssemblyId‘设置为false”。
编辑:我被要求包含pom文件,这是不允许的。我包括导致错误的maven程序集插件块。
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>some.company.hello</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- prevent appending <descriptorRef> "jar-with-dependencies" to final jar name -->
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<!-- For inheritance merges -->
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> 发布于 2022-03-21 19:10:18
This answer解释了技术细节,但我认为关键是你在问题中提到的短语。
我有一个maven项目,生成一个jar,而不是附加maven-assembly的appendAssemblyId。
如果我理解正确的话,我认为这意味着在你的pom文件中,你有一个条目,上面写着
<packaging>jar</packaging>这样做是创建一个与maven程序集插件的输出相竞争的jar文件,maven程序集插件获胜,结果只有一个jar文件。实际上,如果要将appendAssemblyId设置为true,将在输出目录中获得两个文件-- <artifact>.jar和<artifact>-jar-with-dependencies.jar。
因此,首先,您应该删除我前面提到的<packaging>标记,并将以下内容添加到pom文件的<executions>部分,这样就不会有两个相互冲突/相互竞争的jar文件(并且警告将消失):
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>https://stackoverflow.com/questions/54583804
复制相似问题