因此,我有一个要使用的库,并且将其保存在名为“ lib”的文件夹中,我在maven中工作,因此将其放在了pom.xml中
<dependency>
<groupId>org.worldborder</groupId>
<artifactId>worldborder</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}/src/lib/WorldBorder.jar</systemPath>
</dependency>
这样做可以使我编写使用所述库的代码,但是当我构建jar时,使用该类时找不到类定义错误,当我使用mvn clean install时,在构建时会收到警告,
Some problems were encountered while building the effective model for me.acidviper:ViperUHC:jar:1.0-SNAPSHOT
'dependencies.dependency.systemPath' for org.worldborder:worldborder:jar should not point at files within the project directory, ${basedir}/src/lib/WorldBorder.jar will be unresolvable by dependent projects @ line 85, column 25
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
关于Maven,我是一个完全菜鸟,所以我不知道如何解决此错误。任何帮助表示赞赏。谢谢!
嗨,我遇到了同样的问题。为了解决这个问题,我将那个jar直接安装到了本地.m2存储库中。
mvn install:install-file
-Dfile=/path/to/jar
-DgroupId=org.worldborder
-DartifactId=worldborder
-Dversion=1.0.0
-Dpackaging=jar
然后,如果您使用的是Spring Boot,则可以使用spring-boot-maven-plugin
。它为您的应用程序创建了一个完整的jar文件,其中包含所有依赖项
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句