将外部 jar 添加到 Maven 存储库不起作用
Adding external jar to maven repository not working
我已经按照 maven 文档中的说明在我的本地存储库中安装了我的 jar :
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<dans>
-DartifactId=<dans-lib>
-Dversion=<1.0.0>
-Dpackaging=<jar>
-DgeneratePom=true
我可以在我的 /home/.m2/repository 中看到该位置已创建,在 dans/dans-lib/1.0.0 中有我的 jar 文件。
不幸的是,当我试图在我的 pom.xml
中添加 Maven 依赖项时
<dependency>
<groupId>dans</groupId
<artifactId>dans-lib</artifactId>
<version>1.0.0</version>
</dependency>
我收到错误依赖项 dans:dans-lib 未找到。我不知道可能是什么问题
第一个解决方案是将本地存储库添加到 pom.xml 类似这样的东西
<repositories>
<repository>
<id>local-maven-repo</id>
<url>file:///${project.basedir}/local-maven-repo</url>
</repository>
</repositories>
第二个解决方案是加载 jar 文件
<dependency>
<groupId>dans</groupId
<artifactId>dans-lib</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/Name_Your_JAR.jar</systemPath>
</dependency>
我已经按照 maven 文档中的说明在我的本地存储库中安装了我的 jar :
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<dans>
-DartifactId=<dans-lib>
-Dversion=<1.0.0>
-Dpackaging=<jar>
-DgeneratePom=true
我可以在我的 /home/.m2/repository 中看到该位置已创建,在 dans/dans-lib/1.0.0 中有我的 jar 文件。 不幸的是,当我试图在我的 pom.xml
中添加 Maven 依赖项时<dependency>
<groupId>dans</groupId
<artifactId>dans-lib</artifactId>
<version>1.0.0</version>
</dependency>
我收到错误依赖项 dans:dans-lib 未找到。我不知道可能是什么问题
第一个解决方案是将本地存储库添加到 pom.xml 类似这样的东西
<repositories>
<repository>
<id>local-maven-repo</id>
<url>file:///${project.basedir}/local-maven-repo</url>
</repository>
</repositories>
第二个解决方案是加载 jar 文件
<dependency>
<groupId>dans</groupId
<artifactId>dans-lib</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/Name_Your_JAR.jar</systemPath>
</dependency>