I am writing an application that requires me to download a jar based on mavens groupid / artifactid / version.
I am currently starting with
public Model pomToModel(String pomUrl) throws Exception {
URL url = new URL(pomUrl);
InputStream stream = url.openStream();
try {
Model model = new MavenXpp3Reader().read(stream);
return model;
} finally {
stream.close();
}
}
Therefore, given the POM URL, I now have a maven Model object representing it. This seems to work well.
What I would like to know are two things:
- find the jar artifact url that the model represents in the maven repository that the maven plugin used
- based on the model, find the file representing the jar in the local repository
: mvnrepository.com , URL-, ~/.m2/repository . , , , , maven.
, , maven.
google, - maven jars ( stackoverflow) , , maven, maven.