use of org.apache.maven.artifact.DefaultArtifact in project maven-plugins by apache.
the class DependencyProjectStub method getArtifact.
public Artifact getArtifact() {
if (artifact == null) {
ArtifactHandler ah = new DefaultArtifactHandlerStub("jar", null);
VersionRange vr = VersionRange.createFromVersion("1.0");
Artifact art = new DefaultArtifact("group", "artifact", vr, Artifact.SCOPE_COMPILE, "jar", null, ah, false);
setArtifact(art);
}
return artifact;
}
use of org.apache.maven.artifact.DefaultArtifact 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.DefaultArtifact in project maven-plugins by apache.
the class TestJavadocMavenProjectStub method getArtifacts.
@Override
public Set<Artifact> getArtifacts() {
Artifact junit = new DefaultArtifact("junit", "junit", VersionRange.createFromVersion("3.8.1"), Artifact.SCOPE_TEST, "jar", null, new DefaultArtifactHandler("jar"), false);
junit.setFile(new File(getBasedir() + "/junit/junit/3.8.1/junit-3.8.1.jar"));
return Collections.singleton(junit);
}
use of org.apache.maven.artifact.DefaultArtifact 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();
}
use of org.apache.maven.artifact.DefaultArtifact in project intellij-community by JetBrains.
the class Maven3ServerEmbedder 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, "", Artifact.SCOPE_COMPILE, "pom", null, new DefaultArtifactHandler("pom"));
List<ArtifactVersion> versions = getComponent(ArtifactMetadataSource.class).retrieveAvailableVersions(artifact, getLocalRepository(), convertRepositories(remoteRepositories));
return ContainerUtil.map(versions, new Function<ArtifactVersion, String>() {
@Override
public String fun(ArtifactVersion version) {
return version.toString();
}
});
} catch (Exception e) {
Maven3ServerGlobals.getLogger().info(e);
}
return Collections.emptyList();
}
Aggregations