use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project maven-plugins by apache.
the class AbstractAntTestMavenProjectStub method getTestArtifacts.
/**
* @see org.apache.maven.project.MavenProject#getTestArtifacts()
*/
public List getTestArtifacts() {
Artifact junit = new DefaultArtifact("junit", "junit", VersionRange.createFromVersion("3.8.2"), Artifact.SCOPE_TEST, "jar", null, new DefaultArtifactHandler("jar"), false);
junit.setFile(new File("junit/junit/3.8.2/junit-3.8.2.jar"));
return Collections.singletonList(junit);
}
use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project maven-plugins by apache.
the class AbstractAntTestMavenProjectStub method getCompileArtifacts.
/**
* @see org.apache.maven.project.MavenProject#getCompileArtifacts()
*/
public List getCompileArtifacts() {
Artifact junit = new DefaultArtifact("junit", "junit", VersionRange.createFromVersion("3.8.2"), Artifact.SCOPE_TEST, "jar", null, new DefaultArtifactHandler("jar"), false);
junit.setFile(new File("junit/junit/3.8.2/junit-3.8.2.jar"));
return Collections.singletonList(junit);
}
use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project maven-plugins by apache.
the class ResolutionManagementInfoTest method testAddSingleArtifactWithReplacemen.
public void testAddSingleArtifactWithReplacemen() throws Exception {
ResolutionManagementInfo rmi = new ResolutionManagementInfo(new MavenProject());
Artifact a1 = new DefaultArtifact("groupid", "1", VersionRange.createFromVersion("1.0"), "test", "jar", null, new DefaultArtifactHandler());
rmi.addArtifacts(Collections.singleton(a1));
Artifact a2 = new DefaultArtifact("groupid", "1", VersionRange.createFromVersion("1.0"), "compile", "jar", null, new DefaultArtifactHandler());
rmi.addArtifacts(Collections.singleton(a2));
assertEquals(1, rmi.getArtifacts().size());
Artifact next = rmi.getArtifacts().iterator().next();
assertEquals("compile", next.getScope());
}
use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project maven-plugins by apache.
the class TestDefaultMarkerFileHandler method setUp.
protected void setUp() throws Exception {
super.setUp();
ArtifactHandler ah = new DefaultArtifactHandler();
VersionRange vr = VersionRange.createFromVersion("1.1");
Artifact artifact = new DefaultArtifact("test", "1", vr, Artifact.SCOPE_COMPILE, "jar", "", ah, false);
artifacts.add(artifact);
artifact = new DefaultArtifact("test", "2", vr, Artifact.SCOPE_PROVIDED, "war", "", ah, false);
artifacts.add(artifact);
artifact = new DefaultArtifact("test", "3", vr, Artifact.SCOPE_TEST, "sources", "", ah, false);
artifacts.add(artifact);
artifact = new DefaultArtifact("test", "4", vr, Artifact.SCOPE_RUNTIME, "zip", "", ah, false);
artifacts.add(artifact);
outputFolder = new File("target/markers/");
DependencyTestUtils.removeDirectory(this.outputFolder);
assertFalse(outputFolder.exists());
}
use of org.apache.maven.artifact.handler.DefaultArtifactHandler in project intellij-community by JetBrains.
the class Maven2ServerEmbedderImpl method retrieveAvailableVersions.
@NotNull
@Override
public List<String> retrieveAvailableVersions(@NotNull String groupId, @NotNull String artifactId, @NotNull List<MavenRemoteRepository> remoteRepositories) throws RemoteException {
try {
Artifact artifact = new DefaultArtifact(groupId, artifactId, VersionRange.createFromVersion(""), Artifact.SCOPE_COMPILE, "pom", null, new DefaultArtifactHandler("pom"));
ArtifactRepositoryLayout repositoryLayout = getComponent(ArtifactRepositoryLayout.class);
List versions = getComponent(ArtifactMetadataSource.class).retrieveAvailableVersions(artifact, new DefaultArtifactRepository("local", getLocalRepositoryFile().getPath(), repositoryLayout), convertRepositories(remoteRepositories));
List<String> result = new ArrayList<String>();
for (Object version : versions) {
result.add(version.toString());
}
return result;
} catch (Exception e) {
Maven2ServerGlobals.getLogger().info(e);
}
return Collections.emptyList();
}
Aggregations