I have an application built with Maven 2 with duplicate dependencies from both SpringSource Enterprise Bundle Repository and Maven2 public repository. Fortunately they have the same version but I still would like to clean-up the duplicates.
Should I favor Spring repository or Maven?
My project uses Spring a lot (core, web flow, security), so I would tend to say that I should use Spring repo but I don't need my jar files to be OSGi compliant and the long prefixed names annoy me a bit.
Example of duplicates:
com.springsource.org.apache.commons.logging
and commons-logging
org.springframework.core
and spring-core
Once you have created your Maven repository, go to Application | Artifactory | Artifacts, select your Maven repository and click Set Me Up. In the Set Me Up dialog, click Generate Maven Settings. You can now specify the repositories you want to configure for Maven.
Maven just goes through the list and looks into all the repositories. It is not possible to tie dependencies to special repositories.
Maven's local repository is a directory on the local machine that stores all the project artifacts. When we execute a Maven build, Maven automatically downloads all the dependency jars into the local repository. Usually, this directory is named . m2.
My project uses Spring a lot (core, web flow, security), so I would tend to say that I should use Spring repo
You should use the repository that provides the version of the artifacts you want to use :) If you want to use OSGI compatible artifacts, use SpringSource Enterprise Bundle Repository (EBR). If you don't care about OSGI, then it doesn't matter, as long as you don't mix artifacts. That's the official recommendation from SpringSource.
Personally, I would just use Maven Central (SpringSource does publish final releases to Central).
And if you're looking for RC, milestones, or SNAPSHOTS, you can always get them from Spring's Maven Central compatible repositories:
Obtaining Spring Milestone Releases
Milestones and Release Candidates may not be published directly to Maven Central, and in general are published separately from final releases. SpringSource hosts two repositories for obtaining Spring milestones. The first one should be used in conjunction with Maven Central, and the second one in conjunction with the EBR.
Obtaining Milestones from the Maven Central Compatible Repository
To obtain Spring milestones from the Maven Central compatible repository, add the following repository to your .pom:
<repository> <id>org.springframework.maven.milestone</id> <name>Maven Central Compatible Spring Milestone Repository</name> <url>http://maven.springframework.org/milestone</url> </repository>
...
Obtaining Nightly Spring Snapshots
Snapshots of Spring projects are published each night, allowing users to verify that reported issues have been resolved before the next release. Like Milestones, there is a separate Maven Central compatible snapshot repository and an EBR snapshot repository.
Obtaining Snapshots from the Maven Central Compatible Repository
To obtain Spring nightly snapshots from the Maven Central compatible repository, add the following repository to your .pom:
<repository> <id>org.springframework.maven.snapshot</id> <name>Maven Central Compatible Spring Snapshot Repository</name> <url>http://maven.springframework.org/snapshot</url> </repository>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With