Package org.eclipse.aether.artifact

Examples of org.eclipse.aether.artifact.DefaultArtifact


        {
            props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
        }

        Artifact artifact =
            new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
                                 dependency.getVersion(), props, stereotype );

        List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
        for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
        {
View Full Code Here


            String localPath = ( artifact.getFile() != null ) ? artifact.getFile().getPath() : "";
            props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, localPath );
        }

        Artifact result =
            new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(),
                                 artifact.getArtifactHandler().getExtension(), version, props,
                                 newArtifactType( artifact.getType(), artifact.getArtifactHandler() ) );
        result = result.setFile( artifact.getFile() );

        return result;
    }
View Full Code Here

        {
            props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
        }

        Artifact artifact =
            new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
                                 dependency.getVersion(), props, stereotype );

        List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
        for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
        {
View Full Code Here

        System.setProperty(SUREFIRE_CP_KEY, createFakeClassPath());

        ClasspathWorkspaceReader reader = new ClasspathWorkspaceReader();

        // this should not fail
        File file = reader.findArtifact(new DefaultArtifact("foo:bar:1"));
        Assert.assertThat(file, is(nullValue()));
    }
View Full Code Here

        Map<String, String> props = null;
        if (system) {
            props = Collections.singletonMap(ArtifactProperties.LOCAL_PATH, dependency.getSystemPath());
        }

        Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(),
                dependency.getClassifier(), null, dependency.getVersion(), props, stereotype);

        Set<MavenDependencyExclusion> exclusions = new LinkedHashSet<MavenDependencyExclusion>();
        for (org.apache.maven.model.Exclusion e : dependency.getExclusions()) {
            exclusions.add(fromExclusion(e));
        }

        final PackagingType packaging = PackagingType
                .of(artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()));
        final String classifier = artifact.getClassifier().length() == 0 ? packaging.getClassifier() : artifact.getClassifier();

        final MavenCoordinate coordinate = MavenCoordinates.createCoordinate(artifact.getGroupId(),
                artifact.getArtifactId(), artifact.getVersion(), packaging, classifier);

        // SHRINKRES-123 Allow for depMgt explicitly not setting scope
        final String resolvedScope = dependency.getScope();
        final boolean undeclaredScope = resolvedScope == null;
View Full Code Here

        return list;
    }

    public static Artifact asArtifact(MavenCoordinate coordinate, ArtifactTypeRegistry registry) throws CoordinateParseException {
        try {
            return new DefaultArtifact(coordinate.getGroupId(), coordinate.getArtifactId(),
                    coordinate.getClassifier(), coordinate.getPackaging().getExtension(), coordinate.getVersion(), registry.get(coordinate.getPackaging().getId()));
        } catch (IllegalArgumentException e) {
            throw new CoordinateParseException("Unable to create artifact from invalid coordinates "
                    + coordinate.toCanonicalForm());
        }
View Full Code Here

public class MavenCoordinateParserTestCase {
    @Test
    public void testGAV() {
        final String coords = "g:a:1";

        Artifact artifact = new DefaultArtifact(coords);
        Assert.assertEquals("g", artifact.getGroupId());
        Assert.assertEquals("a", artifact.getArtifactId());
        Assert.assertEquals("1", artifact.getVersion());
        Assert.assertEquals("", artifact.getClassifier());
        Assert.assertEquals("jar", artifact.getExtension());

        MavenCoordinateParser dependency = MavenCoordinateParser.parse(coords);
        Assert.assertEquals("g", dependency.getGroupId());
        Assert.assertEquals("a", dependency.getArtifactId());
        Assert.assertEquals("1", dependency.getVersion());
View Full Code Here

    @Test
    public void testGATV() {
        final String coords = "g:a:pom:1";

        Artifact artifact = new DefaultArtifact(coords);
        Assert.assertEquals("g", artifact.getGroupId());
        Assert.assertEquals("a", artifact.getArtifactId());
        Assert.assertEquals("1", artifact.getVersion());
        Assert.assertEquals("", artifact.getClassifier());
        Assert.assertEquals("pom", artifact.getExtension());

        MavenCoordinateParser dependency = MavenCoordinateParser.parse(coords);
        Assert.assertEquals("g", dependency.getGroupId());
        Assert.assertEquals("a", dependency.getArtifactId());
        Assert.assertEquals("1", dependency.getVersion());
View Full Code Here

    @Test
    public void testGAemptyTV() {
        final String coords = "g:a::1";

        Artifact artifact = new DefaultArtifact(coords);
        Assert.assertEquals("g", artifact.getGroupId());
        Assert.assertEquals("a", artifact.getArtifactId());
        Assert.assertEquals("1", artifact.getVersion());
        Assert.assertEquals("", artifact.getClassifier());
        Assert.assertEquals("jar", artifact.getExtension());

        MavenCoordinateParser dependency = MavenCoordinateParser.parse(coords);
        Assert.assertEquals("g", dependency.getGroupId());
        Assert.assertEquals("a", dependency.getArtifactId());
        Assert.assertEquals("1", dependency.getVersion());
View Full Code Here

    @Test
    public void testGATCV() {
        final String coords = "g:a:pom:sources:1";

        Artifact artifact = new DefaultArtifact(coords);
        Assert.assertEquals("g", artifact.getGroupId());
        Assert.assertEquals("a", artifact.getArtifactId());
        Assert.assertEquals("1", artifact.getVersion());
        Assert.assertEquals("sources", artifact.getClassifier());
        Assert.assertEquals("pom", artifact.getExtension());

        MavenCoordinateParser dependency = MavenCoordinateParser.parse(coords);
        Assert.assertEquals("g", dependency.getGroupId());
        Assert.assertEquals("a", dependency.getArtifactId());
        Assert.assertEquals("1", dependency.getVersion());
View Full Code Here

TOP

Related Classes of org.eclipse.aether.artifact.DefaultArtifact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.