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 complia开发者_JAVA百科nt 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
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>
Reference
- Obtaining Spring 3 Artifacts with Maven
The SpringSource repository is generally more up-to-date when it comes to Spring artifacts. So I would add that one to your POM just for the Spring jars. I would grap things like commons-logging from Maven central, unless your interested in OSGI compatibility.
精彩评论