我事先查看了这个问题并看到了其他类似问题,但没有一个解决方案适合我。
我是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的任何好的教程视频
答案 0 :(得分:5)
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