Package org.apache.maven.artifact

Examples of org.apache.maven.artifact.DefaultArtifact


            desiredScope = Artifact.SCOPE_SYSTEM;
        }
       
        ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );

        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
                                    optional );
    }
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

    public void testWriteFeature() throws XMLStreamException, UnsupportedEncodingException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FeatureMetaDataExporter featureMetaDataExporter = new FeatureMetaDataExporter(baos);
       
        BundleRef bundle = new BundleRef("mvn:org.apache.example/example/1.0.0", 10);
        Artifact bundleArtifact = new DefaultArtifact("org.apache.example", "example", "1.0.0",
                                                      null, "jar", null,
                                                      new DefaultArtifactHandler());
        bundle.setArtifact(bundleArtifact);

        ArtifactRef configFile = new ArtifactRef("mvn:org.apache.example/example/1.0.0/cfg");
        Artifact configFileArtifact = new DefaultArtifact("org.apache.example", "example", "1.0.0",
                                                          null, "xml", "exampleconfig",
                                                          new DefaultArtifactHandler());
        configFile.setArtifact(configFileArtifact);

        Feature feature = new Feature("example");
View Full Code Here

    private Artifact createArtifact( String groupId, String artifactId, String type, String version, String scope )
    {
        VersionRange versionRange = VersionRange.createFromVersion( version );
        ArtifactHandler handler = new DefaultArtifactHandler();

        return new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, handler );
    }
View Full Code Here

    private Artifact createArtifact( String groupId, String artifactId, String type, String version, String scope )
    {
        VersionRange versionRange = VersionRange.createFromVersion( version );
        ArtifactHandler handler = new DefaultArtifactHandler();

        return new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, handler );
    }
View Full Code Here

     * @return an artifact with the specified values and configured for testing to the local m2repo
     */
    private Artifact createArtifact( String groupId, String artifactId, String version )
    {
        Artifact artifact =
            new DefaultArtifact( groupId, artifactId, VersionRange.createFromVersion( version ), "scope-unused",
                                 "eclipse-plugin", "classifier-unused", null );
        artifact.setFile( locateArtifact( artifact ) );

        return artifact;
    }
View Full Code Here

                                                final String classifier )
    {
        ArtifactHandler artifactHandler = new DefaultArtifactHandler();

        VersionRange version = VersionRange.createFromVersion( versionRange );
        return new DefaultArtifact( groupId, artifactId, version, scope, type, classifier, artifactHandler );
    }
View Full Code Here

        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;
    }
View Full Code Here

    {
        super.setUp();

        ArtifactHandler ah = new DefaultArtifactHandlerStub( "jar", null );
        VersionRange vr = VersionRange.createFromVersion( "1.1" );
        release = new DefaultArtifact( "test", "one", vr, Artifact.SCOPE_COMPILE, "jar", "sources", ah, false );
        artifacts.add( release );

        ah = new DefaultArtifactHandlerStub( "war", null );
        vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
        snap = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "war", null, ah, false );
        artifacts.add( snap );

        ah = new DefaultArtifactHandlerStub( "war", null );
        vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
        sources = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "sources", "sources", ah, false );

        // pick random output location
        Random a = new Random();
        outputFolder = new File( "target/copy" + a.nextLong() + "/" );
        outputFolder.delete();
View Full Code Here

    public void testTestJar()
    {
        ArtifactHandler ah = new DefaultArtifactHandlerStub( "test-jar", null );
        VersionRange vr = VersionRange.createFromVersion( "1.1-SNAPSHOT" );
        Artifact artifact = new DefaultArtifact( "test", "two", vr, Artifact.SCOPE_PROVIDED, "test-jar", null, ah,
                                                 false );

        String name = DependencyUtil.getFormattedFileName( artifact, false );
        String expectedResult = "two-1.1-SNAPSHOT.jar";
        assertEquals( expectedResult, name );
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.