简体   繁体   中英

Maven fails to find local repo artifact

I am getting this:

Failed to execute goal on project boot: Could not resolve dependencies for project xxx:boot:jar:1.0.0-SNAPSHOT: Could not find artifact xxx:xxx:jar:1.0.0-SNAPSHOT in central (http://xxx/artifactory/all/) -> [Help 1]

That arifact is ONLY in my local repo. (Yes I can see it there) Maven is not picking up.

I see alot of ideas on SO but none of them have worked.

I have tried all of the sugestions on SO:

find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;

find ~/.m2/repository -name _remote.repositories -exec rm -v {} \;

I deleted the repo and re-built (ie. mvn install) all the needed dependencies.

I added

<snapshots>
    <enabled>true</enabled>
    <updatePolicy>never</updatePolicy>
</snapshots>

to the POM

I tried mvn -o install

I am not sure what to try next! I am using mvn 3.3.9 on Ubuntu 16.04

Given your information, I would say you might have to run the full command (especially for jars built before the 2.5 version of Maven), which should be (replace with what's convenient): mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \\ -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

See: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

Make sure that localRepository tag in your settings.xml actually points to the m2 repository location on your machine. You will find settings.xml in %M2_HOME%/conf directory

If you are trying to run a maven build for a child project which is dependent on another parallel level child project. Just run a maven build on the parent project once.It resolved the issue for me.

for me , it was a multimodule maven project and the parent module's version didn't match the versions of the child modules. And so apprently the project didn't install well

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