简体   繁体   中英

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.

But when i do mvn clean compile am getting the below error.

[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 . Then change property of offline mode to true .

<settings>
    ...

    <profiles>
        <profile>
            ...
        </profile>
    </profiles>

    <offline>true</offline>
</settings>

After that everything should work, because Maven always tried to connect to central repository.

I am having the similar issue, I have 2 java projects , the first project produces a java library and the second project uses it.

The first project is build via first job and it installs the library in /home/runner/.m2/repository/ succesfully

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]

In my second project, i have included the dependency to load this library jar(produced by first project) from the repository.

MY understanding is that my second project should load the jar library from the /home/runner/.m2/repository/ but its not loading it.

Any help is appreciated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM