尝试在 spigot 1.20.4 上使用 nms 时出现此错误 对于这个,我尝试在artifactID中删除-api,就像教程中的锯子一样。
这是我的
pom.xml
文件的一部分:
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
错误:
Unresolved dependency: 'org.spigotmc:spigot:jar:1.20.4-R01-SNAPSHOT'
Could not find artifact org.spigotmc:spigot:jar:1.20.4-R01-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Try to run Maven import with -U flag (force update snapshots)
我也尝试过使用 spigot-server
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-server</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
出现此错误
[WARNING] The POM for org.spigotmc:spigot-server:jar:1.20.4-R0.1-SNAPSHOT is missing, no dependency information available
Cannot resolve org.spigotmc:spigot-server:1.20.4-R0.1-SNAPSHOT
Could not find artifact org.spigotmc:spigot-server:pom:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Could not find artifact org.spigotmc:spigot-server:pom:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Could not find artifact org.spigotmc:spigot-server:jar:1.20.4-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Try to run Maven import with -U flag (force update snapshots)
右边的是
spigot
,像这样:
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
</dependencies>
但是,为了能够找到,您必须使用以下命令来BuildTools:
java -jar BuildTools.jar --rev 1.20.4 --remapped
(您需要 Java 17 或更高版本)
然后,构建结束后,spigot 版本将在 local 存储库(位于
%HOMEDIR%/.m2/repository/org/spigotmc/spigot/1.20.4.
)上可用。现在您可以刷新项目了。
更多信息这里。