no

How to Fix Could Not Resolve Dependencies Exception

I just have this weird problem using maven + artifactory. I have a project which I first build using maven-compiler 2.3.2, and maven2. It bu...

I just have this weird problem using maven + artifactory. I have a project which I first build using maven-compiler 2.3.2, and maven2. It build successfully and I was able to deploy in artifatory 2.5.

Eventually I've added several modules and one requires the use of maven-compiler-plugin 2.4, which also requires me to install maven3, because I'm having several errors otherwise. So my app is working again.

But when I checkout on a new machine and maven compiles, I got the ff error:
Could not resolve dependencies for project com.xxxjar:0.0.1-SNAPSHOT: Failed to collect depend
encies for . Failure to find  in  was cached in the local repository, resolution will not be reattempted until the update interval of  has elapsed or updates are forced.
What's weird is that when I carry over, my m2 directory from the first machine where I have first develop with maven2, it compiles without error. So clearly some setting or jar is being missed by maven3?

Additional info: When I run install in another machine I have:
2012-05-25 17:21:32,316 [pool-1-thread-3] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,342 [pool-1-thread-13] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,350 [pool-1-thread-7] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'libs-release-local' rejected the artifact 'libs-release-local:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..


There are 2 root causes of these problem:
1.) mvn3 doesn't support non-unique repository. So you need to set your snapshot repository in artifactory to Unique.
2.) You need to deploy the parent project for your dependency, even if it's just a pom (this was my problem, I was only able to deploy the dependency project). For example you have:
+ParentProjectXXX
++DependencyA
++DependencyB

Let's assume that DependencyB, are your model classes and you wanted to use it in another project, let's say ParentProjectYYY (so you add it as a dependency). Of course, the project would build on the same machine where you mvn install ParentProjectXXX, because it has access to it. But when you compile ParentProjectYYY on another machine it will be able to download DependencyB, but not ParentProjectXXX (pom type) because I haven't deployed it, so it will cause a problem with your maven problem.

The solution is simple, issue the mvn deploy command from the parent project. So all modules, dependencies of that project are deployed to artifactory (remote repository).

Related

java-troubleshooting 5917313323200942683

Post a Comment Default Comments

1 comment

Anonymous said...

It'll be something like http://www.artifactory.org

item