Finding list of versions available in a Maven repository for a specific plugin?
Asked Answered
M

4

20

Given the following repository URL from my pom.xml how can I determine what the latest versions of spring and hibernate are available in the repository? http://repo1.maven.org/maven2

Muddlehead answered 3/9, 2009 at 15:17 Comment(0)
A
5

Programatically or just manually?

Since the repository works over HTTP you can just navigate it manually:

http://repo2.maven.org/maven2/org/springframework/spring/ http://repo2.maven.org/maven2/org/hibernate/hibernate/ http://repo2.maven.org/maven2/org/hibernate/hibernate-core/

Abvolt answered 3/9, 2009 at 15:19 Comment(0)
C
24

Retrieve the maven-metadata.xml file, placed in the artifact directory, e.g. https://repo1.maven.org/maven2/com/sun/media/jai_codec/maven-metadata.xml for an artifact with the groupId com.sun.media and artifactId jai_codec.

<?xml version="1.0" encoding="UTF-8"?>

<metadata>
  <groupId>com.example</groupId>
  <artifactId>project</artifactId>
  <versioning>
    <latest>0.0.5</latest>
    <release>0.0.5</release>

    <versions>
      <version>0.0.3</version>
      <version>0.0.4</version>
      <version>0.0.5</version>
    </versions>
    <lastUpdated>20090725212606</lastUpdated>
  </versioning>

</metadata>
Carrousel answered 3/9, 2009 at 16:11 Comment(1)
How I can get URL to maven plugin in automatic way (from command line)?Oddson
A
5

Programatically or just manually?

Since the repository works over HTTP you can just navigate it manually:

http://repo2.maven.org/maven2/org/springframework/spring/ http://repo2.maven.org/maven2/org/hibernate/hibernate/ http://repo2.maven.org/maven2/org/hibernate/hibernate-core/

Abvolt answered 3/9, 2009 at 15:19 Comment(0)
R
2

As Robert's answer says, the maven-metadata.xml file for each artifact in the repository holds the version information you need. In particular note the latest and release elements in the metadata. The latest element denotes the last version to be published, this may not be the version you want though. For example it could be a maintenance release to an older version, a release candidate, or a milestone. The release version denotes the last published version intended to be treated as a release, so generally you'd want to take this version.

For information the Maven super POM has a special release-profile profile, activated by setting the performRelease property (e.g. by passing -DperformRelease on the command line). Amongst other things, activating this property will set the updateReleaseInfo property of the deploy-plugin so that the metadata will be updated when you deploy.

Rawlins answered 6/9, 2009 at 12:16 Comment(0)
D
1

Depending on what the real use case is, it can be worth looking at http://www.mojohaus.org/versions-maven-plugin/

Dominicadominical answered 22/10, 2015 at 11:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.