您正在使用maven shade插件复制某些依赖项的内容,并将其作为自己的工件包含到生成的工件中.问题是,META-INF目录中的文件通常特定于它们分发的原始jar文件,并且它们的命名非常标准,因此多个jar包含名为MANIFEST的文件也就不足为奇了.MF.
这就是关于重叠资源的警告的原因——这本身对您的目的是无害的.但是,如果打包到JGIT META-INF中的剩余文件存在问题,请排除它们.
此配置将防止从项目中包含的任何依赖项复制META-INF:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
或者,如果插件规范要求您包含自己的 list .MF,你可以创建这样一个:
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Title>this is a title</Title>
<Some-Field-Name>some value</Some-Field-Name>
</manifestEntries>
</transformer>
</transformers>
</configuration>
另外,关于问题的最后一部分——你的项目依赖于版本中的spigot-api
,后缀为SNAPSHOT
,这意味着开发人员可以随时更新这个版本,而无需更改编号.为了让maven知道是否有更新的版本,它必须查看存储库列表,并询问每个存储库是否有更新的工件.
在repositories部分中有3个repo,您可能希望禁用对快照更新的判断,如下所示:
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jgit-repository</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
不过,你不应该在spigotmc-repo
天内禁用此功能,并且希望每天都能判断此repo的更新,除非你 Select 一个非快照版本,该版本一旦发布并下载到你的电脑上,就永远不需要更新.