[英]maven unable to resolve dependency and cannot access jar
I have my project dependencies in my pom.xml
file and the required dependencies ( its another project ) jar has been available in .m2
directory.我的
pom.xml
文件中有我的项目依赖项,并且所需的依赖项(它的另一个项目)jar 在.m2
目录中可用。
But when i do mvn clean compile
am getting the below error.但是当我执行
mvn clean compile
时出现以下错误。
[ERROR] Failed to execute goal on project core: Could not resolve dependencies for project war:1.0-SNAPSHOT:
Cannot access pscs (http://demo01.corp.cat.com:8081/nexus/content/repositories/releases/)
in offline mode and the artifact api-client:jar:1.0.282 has not been downloaded from it before. -> [Help 1]
But the same dependencies in some other project is working fine.但是其他项目中的相同依赖项工作正常。
Go to settings.xml
file which is under \\.m2\\settings.xml
.转到位于
\\.m2\\settings.xml
下的settings.xml
文件。 Then change property of offline
mode to true
.然后将
offline
模式的属性更改为true
。
<settings>
...
<profiles>
<profile>
...
</profile>
</profiles>
<offline>true</offline>
</settings>
After that everything should work, because Maven always tried to connect to central repository.之后一切都应该正常了,因为 Maven 总是试图连接到中央存储库。
I am having the similar issue, I have 2 java projects , the first project produces a java library and the second project uses it.我有类似的问题,我有 2 个 java 项目,第一个项目生成一个 java 库,第二个项目使用它。
The first project is build via first job and it installs the library in /home/runner/.m2/repository/ succesfully第一个项目是通过第一份工作构建的,它成功地将库安装在 /home/runner/.m2/repository/
Then when the second project is build via the second job, it fails with error然后当第二个项目通过第二个作业构建时,它失败并出现错误
Failed to execute goal on project <>: Could not resolve dependencies for project ....................Could not find artifact <>:jar:1.0-SNAPSHOT -> [Help 1]无法在项目 <> 上执行目标:无法解析项目的依赖项........................找不到工件 <>:jar:1.0-SNAPSHOT -> [帮助 1]
In my second project, i have included the dependency to load this library jar(produced by first project) from the repository.在我的第二个项目中,我已经包含了从存储库加载这个库 jar(由第一个项目生成)的依赖项。
MY understanding is that my second project should load the jar library from the /home/runner/.m2/repository/ but its not loading it.我的理解是我的第二个项目应该从 /home/runner/.m2/repository/ 加载 jar 库,但它没有加载它。
Any help is appreciated.任何帮助表示赞赏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.