Search in sources :

Example 6 with DefaultArtifactHandler

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);
}
Also used : DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 7 with DefaultArtifactHandler

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);
}
Also used : DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 8 with DefaultArtifactHandler

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());
}
Also used : MavenProject(org.apache.maven.project.MavenProject) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 9 with DefaultArtifactHandler

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());
}
Also used : DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) ArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) VersionRange(org.apache.maven.artifact.versioning.VersionRange) File(java.io.File) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact)

Example 10 with DefaultArtifactHandler

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();
}
Also used : ArtifactRepositoryLayout(org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout) DefaultArtifactHandler(org.apache.maven.artifact.handler.DefaultArtifactHandler) DefaultArtifactRepository(org.apache.maven.artifact.repository.DefaultArtifactRepository) UnicastRemoteObject(java.rmi.server.UnicastRemoteObject) ArtifactMetadataSource(org.apache.maven.artifact.metadata.ArtifactMetadataSource) Artifact(org.apache.maven.artifact.Artifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) DefaultArtifact(org.apache.maven.artifact.DefaultArtifact) TimeoutException(java.util.concurrent.TimeoutException) ArtifactNotFoundException(org.apache.maven.artifact.resolver.ArtifactNotFoundException) InitializationException(org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException) ModelInterpolationException(org.apache.maven.project.interpolation.ModelInterpolationException) InvocationTargetException(java.lang.reflect.InvocationTargetException) RemoteException(java.rmi.RemoteException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) ContextException(org.codehaus.plexus.context.ContextException) ArtifactResolutionException(org.apache.maven.artifact.resolver.ArtifactResolutionException) InvalidRepositoryException(org.apache.maven.artifact.InvalidRepositoryException) ExecutionException(java.util.concurrent.ExecutionException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DefaultArtifactHandler (org.apache.maven.artifact.handler.DefaultArtifactHandler)17 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)16 File (java.io.File)12 Artifact (org.apache.maven.artifact.Artifact)9 ArtifactRepository (org.apache.maven.artifact.repository.ArtifactRepository)7 MavenProjectResourcesStub (org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub)7 MavenProject (org.apache.maven.project.MavenProject)3 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 RemoteException (java.rmi.RemoteException)2 ArtifactHandler (org.apache.maven.artifact.handler.ArtifactHandler)2 ArtifactMetadataSource (org.apache.maven.artifact.metadata.ArtifactMetadataSource)2 VersionRange (org.apache.maven.artifact.versioning.VersionRange)2 ModelBuildingException (org.apache.maven.model.building.ModelBuildingException)2 NotNull (org.jetbrains.annotations.NotNull)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 UnicastRemoteObject (java.rmi.server.UnicastRemoteObject)1