Thursday, May 5, 2011

Finding a Maven Repository

When you define a dependency in pom.xml, you are telling your compiler where to go get JARs from in the Maven archive. This way, you don't need to maintain your libraries and if they are updated, you simply change the version number in your pom.xml file.

If you know what dependency you need, for example, Apache Commons/IO, browse to a Maven mirror such as:
http://mirrors.ibiblio.org/pub/mirrors/maven2/
when you navigate down to:
http://mirrors.ibiblio.org/pub/mirrors/maven2/commons-io/commons-io/
The first and second directories represent the Group ID and the Artifact ID. For example:
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.0.1</version>
        </dependency>
In the above example, the reuse of "commons-io" makes it unclear, but the canonical form is:
http://mirrors.ibiblio.org/pub/mirrors/maven2/groupId/artifactId/

No comments:

Post a Comment