I am using eclipse.aether (version 1.0.0.v20140518) to programmatically extract some maven artifacts from my repository. For this, I use the following code:
Artifact artifact = new DefaultArtifact( artifactName );
ArtifactRequest artifactRequest = new ArtifactRequest().setArtifact( artifact );
repositorySystem.resolveArtifact(session, artifactRequest);
where artifactName is a string in the format "groupId: artifactId: version". When the version is a fixed version (for example, in "org.myNamespace: myProject: 1.0.0"), everything works fine. In addition, I should also be allowed to replace the installed version of "LATEST" (as in "org.myNamespace: myProject: LATEST"), in which case it should download the latest version of this artifact in my repository.
This also works, but only partially, which means that it never retrieves SNAPSHOT artifacts, but only releases it. This does not seem to match the maven semantics, as described here How to tell Maven to use the latest version of the dependency?
Am I doing something wrong? Is there a way to download the latest version of an artifact, whether it is a release or a snapshot?
source
share