我的一个项目出现编译错误
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
因为它没有找到我已经使用
包含的另一个项目中的所有类 <dependency>
<groupId>com.laberint</groupId>
<artifactId>laberint-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
并且我在 Eclipse 中没有遇到任何编译问题。我已经删除了所有存储库。
这些错误是因为laberint-core
Artifact 中缺少所有类。我已经删除了整个存储库文件夹
我还安装了jar
mvn install:install-file -Dfile=laberint-core-0.0.1-SNAPSHOT.jar -DgroupId=com.laberint -DartifactId=laberint-core -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
最佳答案
只需从另一个项目创建一个 jar 并将其添加到当前项目的本地 lib 目录中。另一种选择是将 jar 文件安装到本地 Maven 存储库中,如下所示:-
mvn install:yourlocal-jarfile
-Dfile=<path-to-your jar>
-DgroupId=<group-id> --> the group that the file should be registered under
-DartifactId=<artifact-id> --> give a artifact name to your jar
-Dversion=<version> --> version of your jar file
-Dpackaging=<packaging> --> jar
-DgeneratePom=true
您也可以尝试以下选项:-
<dependency>
<groupId>com.laberint</groupId>
<artifactId>laberint-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<systemPath>/pathto/yourJar.jar</systemPath>
</dependency>
希望这对您有帮助。祝你好运!!!
关于java - maven编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49095247/