Package org.apache.maven.artifact

Examples of org.apache.maven.artifact.DefaultArtifact


        ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL );

        ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), policy, policy );

        Artifact artifact =
            new DefaultArtifact( "sample.group", "sample-art", VersionRange.createFromVersion( "1.0" ), "scope",
                                 "jar", "classifier", null );
        artifact.setFile( getTestFile( "target/sample-art" ) );

        StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );

        wagon.clearExpectedContent();
        wagon.addExpectedContent( "path", "lower-case-checksum" );
View Full Code Here


    @Override
    public Set<Artifact> getDependencyArtifacts()
    {
        Artifact artifact =
            new DefaultArtifact( "junit", "junit", VersionRange.createFromVersion( "3.8.1" ), Artifact.SCOPE_TEST,
                                 "jar", null, new DefaultArtifactHandler( "jar" ), false );
        return Collections.singleton( artifact );
    }
View Full Code Here

    {
        super.setUp();

        database = (MetadataResultsDatabase) lookup( MetadataResultsDatabase.ROLE, "default" );

        Artifact artifact = new DefaultArtifact( "group", "artifact", VersionRange.createFromVersion( "1.0" ), "scope",
                                                 "type", "classifier", null );
        metadata = new ArtifactRepositoryMetadata( artifact );

        processor = "processor";
        problem = "problem";
View Full Code Here

    {
        super.setUp();

        database = (ArtifactResultsDatabase) lookup( ArtifactResultsDatabase.ROLE );

        artifact = new DefaultArtifact( "group", "artifact", VersionRange.createFromVersion( "1.0" ), "scope", "type",
                                        "classifier", null );
        processor = "processor";
        problem = "problem";
        reason = "reason";
    }
View Full Code Here

        tomEEMojo.local = new DefaultArtifactRepository("local", tomEEMojo.settings.getLocalRepository(), new DefaultRepositoryLayout());

        tomEEMojo.factory = ArtifactFactory.class.cast(Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class<?>[]{ArtifactFactory.class}, new InvocationHandler() {
            @Override
            public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                return new DefaultArtifact(
                    tomEEMojo.tomeeGroupId,
                    tomEEMojo.tomeeArtifactId,
                    VersionRange.createFromVersion(tomEEMojo.tomeeVersion),
                    "provided",
                    tomEEMojo.tomeeType,
View Full Code Here

            desiredScope = Artifact.SCOPE_SYSTEM;
        }

        ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );

        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
                                    optional );
    }   
View Full Code Here

        return createArtifact( groupId, artifactId, version, null, packaging );
    }

    public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
    {
        return new DefaultArtifact( groupId, artifactId, version, scope, type, null, new TestArtifactHandler( type ) );
    }
View Full Code Here

    }

    public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
                                                  String classifier )
    {
        return new DefaultArtifact( groupId, artifactId, version, null, type, classifier,
                                    new TestArtifactHandler( type ) );
    }
View Full Code Here

    }

    public Artifact createDependencyArtifact( Dependency dependency )
    {
        Artifact artifact =
            new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
                                 dependency.getScope(), dependency.getType(), dependency.getClassifier(),
                                 new TestArtifactHandler( dependency.getType() ) );

        if ( Artifact.SCOPE_SYSTEM.equals( dependency.getScope() ) )
        {
            artifact.setFile( new File( dependency.getSystemPath() ) );
            artifact.setResolved( true );
        }

        return artifact;
    }
View Full Code Here

    private void mergeProjectDependencies(Set<Artifact> projectDependencies) {
        // Go over all the artifacts taken from the MavenProject object, and replace their equals method, so that we are
        // able to merge them together with the artifacts inside the resolvedArtifacts set:
        Set<Artifact> dependecies = Sets.newHashSet();
        for(Artifact artifact : projectDependencies) {
            DefaultArtifact art = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
                    artifact.getScope(), artifact.getType(), "", artifact.getArtifactHandler()) {

                public boolean equals(Object o) {
                    if (o == this) {
                        return true;
                    }
                    if (!(o instanceof org.apache.maven.artifact.Artifact)) {
                        return false;
                    }
                    return hashCode() == o.hashCode();
                }
            };
            art.setFile(artifact.getFile());
            dependecies.add(art);
        }

        // Now we merge the artifacts from the two collections. In case an artifact is included in both collections, we'd like to keep
        // the one that was taken from the MavenProject, because of the scope it has.
View Full Code Here

TOP

Related Classes of org.apache.maven.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.