maven

How to query Maven repository from application to obtain metadata


I'm trying to migrate an eclipse project to a maven projet. The eclipse project refernces many jars in its .classpath file. I'm looking for a way to generate the corresponding pom dependencies.

Say I have Velocity-3.1.jar, I want my app generate corresponding XML chunk :

  <dependency>
    <groupId>velocity</groupId>
    <artifactId>Apache-velocity</artifactId>
    <version>3.1</version>
  </dependency>

The app was able to query some service and found the groupId, artefactId, version data.

Of course, I accept errors and will check the generated metadata.

Is there some Maven service/plugin which would do the trick ?

many thanks !


Solution

  • You can use the maven central repository API.

    Have a look to the official page: https://central.sonatype.com/

    HIH M.