Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] Resolving test dependencies using aether

Arthur Kalmenson wrote:

Artifact artifact = new
DefaultArtifact("groupId","artifactId","tests","jars","version");

I assume "jars" is a typo, it should read "jar".

(or
Map<String, String>  props = new HashMap<String, String>();
props.put("type","test-jar");
Artifact artifact = new DefaultArtifact("groupId:artifactId:version", props);)

The props provide meta information, they are not relevant for resolution which only considers an artifact's identity as given by groupId, artifactId, version, classifier and extension.


ArtifactRequest artifactRequest = new ArtifactRequest();
artifactRequest.setArtifact(artifact);
artifactRequest.addRepository(repository);
ArtifactResult resolvedArtifact = system.resolveArtifact(session,
artifactRequest);
Artifact file = resolvedArtifact.getArtifact();

But that doesn't download the test jar. Do you happen to know how we
would get aether to resolve the test-jar?

If it doesn't download the test jar, what does it then? It's hard to help if half of the picture is missing. The code you sketched should generally work, there's nothing special to a test-jar, it's a plain JAR artifact with a classifier.


Benjamin


Back to the top