Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use artifacts from Maven repository or Spring repository

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

like image 735
Damien Avatar asked Sep 07 '10 21:09

Damien


People also ask

How do I use Jfrog Artifactory with Maven?

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.

How does Maven decide which repository to use?

Maven just goes through the list and looks into all the repositories. It is not possible to tie dependencies to special repositories.

Where are Maven artifacts stored?

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.


1 Answers

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
like image 187
Pascal Thivent Avatar answered Oct 15 '22 06:10

Pascal Thivent