user684434
user684434

Reputation: 1165

Maven Classifier dependency doesn't resolve always

We use Maven3.0.3 and we use classifier to resolve among dependency for three regions DEV/TEST/PROD. Even though the Nexus maven rep has got the jars with all classifiers(DEV/TEST/PROD) it doesn't always get resolved. We had to build the specific classifier dependencies everytime to get it resolved.

Is there any workaround for this ?

Upvotes: 1

Views: 2157

Answers (2)

Rob van Oostrum
Rob van Oostrum

Reputation: 31

Assuming your dependencies are snapshots, the problem may be the same as what I was seeing: that the snapshot resolves to the latest found in the repository, and it looks for your classifier within that build. So if a different classifier from the one you're looking for was the last to be built, dependency resolution fails. This would seem to be a bug in how Maven is doing its resolution, which appears to have been fixed in Maven 3.0.4 (my only other Maven install is 2.2.x so I can't say for certain whether this is broken in 3.0.3 still).

Also, it could be that you're using a version of say the dependency plugin which still has this problem. Make sure you don't have it pegged to something old.

Upvotes: 3

FrVaBe
FrVaBe

Reputation: 49361

Try to

  • Run maven with -X to produce debug output that may help (see mvn -help). If the artifacts are there but are skipped there must be a reason. Try to find it in the debug outputs.
  • Check the update policy (for snapshot and releases) in your settings.xml - maybe your update is skipped because the update-policy is set to daily (which is the default) but you need "always" because your dependencies are deployed more often (SNAPSHOT).
  • Try to run maven with -X to force an update of your dependencies.

Upvotes: 1

Related Questions