我事先查了一下这个问题,发现其他人也遇到类似的问题,但是没有一个解决方案对我有用。
我对Maven完全陌生,但是我只是从GitHub导入了一个项目。现在我在使依赖项正常工作方面遇到了问题。清洁时,会出现以下错误。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-api:jar:API
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:bukkit:jar should not point at files within the project directory, ${project.basedir}/lib/bukkit-1.8.6-R0.1-SNAPSHOT.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_7_R3:jar:v1_7_R3
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.7.9-R0.2-SNAPSHOT.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_7_R4:jar:v1_7_R4
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.7.10-R0.1.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R1:jar:v1_8_R1
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R2:jar:v1_8_R2
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.3.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:skywarsreloadedplugin-v1_8_R3:jar:v1_8_R3
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:craftbukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.4.jar will be unresolvable by dependent projects @ line 19, column 19
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.walrusone.skywars:SkyWarsReloadedPlugin:jar:V2.8
[WARNING] 'dependencies.dependency.systemPath' for org.bukkit:bukkit:jar should not point at files within the project directory, ${project.basedir}/lib/craftbukkit-1.8.4.jar will be unresolvable by dependent projects @ line 72, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
我相信这与原始错误不同,原始错误告诉我找不到该错误,因此我继续下载所有.jar文件并将其放在正确的位置。现在我不知道该怎么办。
我遇到的另一个问题是,每当我尝试编辑或添加一个类时,它都不会像常规的jar文件那样起作用。键入Main时,我不能喜欢Main.instance.stacticMethod()。它只是坐在那里。
如果您需要任何其他文件,请告诉我。
另外,如果有人知道Maven上的任何优秀教程视频
最佳答案
Maven的要点是您不必下载依赖项。只需克隆项目。您应该在根目录中看到一个文件pom.xml
。然后输入
mvn compile
这应该编译软件并下载进度中的依赖项。依赖关系未存储在项目文件夹中,而是使用默认配置放置在
~/.m2/...
中。编辑:警告似乎是由项目的维护者不正确理解Maven引起的问题。他们似乎在项目中添加了jar,而不是依赖项。
下一步编辑:考虑
pom.xml
模块中的v1_8_R3
文件:它链接到基本目录中的jar:<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.4-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftbukkit-1.8.4.jar</systemPath>
<type>jar</type>
<optional>true</optional>
</dependency>
通常不建议使用系统路径。正确的方法是让开发人员将jar作为单独的工件进行运送。参见this question and the related answers
关于java - 依赖项不应指向项目目录中的文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32384798/