Package org.eclipse.aether.util.artifact

Examples of org.eclipse.aether.util.artifact.SubArtifact


    public void deployArtifact(ReleaseId releaseId, File jar, File pomfile) {
        Artifact jarArtifact = new DefaultArtifact( releaseId.getGroupId(), releaseId.getArtifactId(), "jar", releaseId.getVersion() );
        jarArtifact = jarArtifact.setFile( jar );

        Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" );
        pomArtifact = pomArtifact.setFile( pomfile );

        DeployRequest deployRequest = new DeployRequest();
        deployRequest
                .addArtifact( jarArtifact )
                .addArtifact( pomArtifact )
View Full Code Here


                                                    "jar",
                                                    gav.getVersion() );
        jarArtifact = jarArtifact.setFile( jarFile );

        //pom.xml Artifact
        Artifact pomXMLArtifact = new SubArtifact( jarArtifact,
                                                   "",
                                                   "pom" );
        pomXMLArtifact = pomXMLArtifact.setFile( pomXMLFile );

        try {
            //Install into local repository
            final InstallRequest installRequest = new InstallRequest();
            installRequest
                    .addArtifact( jarArtifact )
                    .addArtifact( pomXMLArtifact );

            Aether.getAether().getSystem().install( Aether.getAether().getSession(),
                                                    installRequest );
        } catch ( InstallationException e ) {
            throw new RuntimeException( e );
        }

        //Deploy into Workbench's default remote repository
        try {
            final DeployRequest deployRequest = new DeployRequest();
            deployRequest
                    .addArtifact( jarArtifact )
                    .addArtifact( pomXMLArtifact )
                    .setRepository( getGuvnorM2Repository() );

            Aether.getAether().getSystem().deploy( Aether.getAether().getSession(),
                                                   deployRequest );

        } catch ( DeploymentException e ) {
            throw new RuntimeException( e );
        }

        //Only deploy to additional repositories if required. This flag is principally for Unit Tests
        if ( !includeAdditionalRepositories ) {
            return;
        }

        //Deploy into remote repository defined in <distributionManagement>
        try {
            final Model model = new MavenXpp3Reader().read( new StringReader( pomXML ) );
            final DistributionManagement distributionManagement = model.getDistributionManagement();

            if ( distributionManagement != null ) {

                final boolean isSnapshot = pomXMLArtifact.isSnapshot();
                DeploymentRepository remoteRepository = null;
                if ( isSnapshot ) {
                    remoteRepository = distributionManagement.getSnapshotRepository();
                } else {
                    remoteRepository = distributionManagement.getRepository();
View Full Code Here

        for ( ArtifactMetadata metadata : artifact.getMetadataList() )
        {
            if ( metadata instanceof ProjectArtifactMetadata )
            {
                org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
                pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
                request.addArtifact( pomArtifact );
            }
            else if ( metadata instanceof SnapshotArtifactRepositoryMetadata
                || metadata instanceof ArtifactRepositoryMetadata )
            {
View Full Code Here

        for ( ArtifactMetadata metadata : artifact.getMetadataList() )
        {
            if ( metadata instanceof ProjectArtifactMetadata )
            {
                org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
                pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
                request.addArtifact( pomArtifact );
            }
            else if ( metadata instanceof SnapshotArtifactRepositoryMetadata
                || metadata instanceof ArtifactRepositoryMetadata )
            {
View Full Code Here

                                                    "jar",
                                                    gav.getVersion() );
        jarArtifact = jarArtifact.setFile( jarFile );

        //pom.xml Artifact
        Artifact pomXMLArtifact = new SubArtifact( jarArtifact,
                                                   "",
                                                   "pom" );
        pomXMLArtifact = pomXMLArtifact.setFile( pomXMLFile );

        try {
            //Install into local repository
            final InstallRequest installRequest = new InstallRequest();
            installRequest
                    .addArtifact( jarArtifact )
                    .addArtifact( pomXMLArtifact );

            Aether.getAether().getSystem().install( Aether.getAether().getSession(),
                                                    installRequest );
        } catch ( InstallationException e ) {
            throw new RuntimeException( e );
        }

        //Deploy into Workbench's default remote repository
        try {
            final DeployRequest deployRequest = new DeployRequest();
            deployRequest
                    .addArtifact( jarArtifact )
                    .addArtifact( pomXMLArtifact )
                    .setRepository( getGuvnorM2Repository() );

            Aether.getAether().getSystem().deploy( Aether.getAether().getSession(),
                                                   deployRequest );

        } catch ( DeploymentException e ) {
            throw new RuntimeException( e );
        }

        //Only deploy to additional repositories if required. This flag is principally for Unit Tests
        if ( !includeAdditionalRepositories ) {
            return;
        }

        //Deploy into remote repository defined in <distributionManagement>
        try {
            final Model model = new MavenXpp3Reader().read( new StringReader( pomXML ) );
            final DistributionManagement distributionManagement = model.getDistributionManagement();

            if ( distributionManagement != null ) {

                final boolean isSnapshot = pomXMLArtifact.isSnapshot();
                DeploymentRepository remoteRepository = null;
                if ( isSnapshot ) {
                    remoteRepository = distributionManagement.getSnapshotRepository();
                } else {
                    remoteRepository = distributionManagement.getRepository();
View Full Code Here

        if(artifactFile!=null) {
            String name = artifactFile.getName();
            String type = name.substring(artifactFile.getName().lastIndexOf(".")+1, name.length());
            Artifact jarArtifact = new DefaultArtifact(groupId, artifactId, classifier, type, version);
            jarArtifact = jarArtifact.setFile(artifactFile);
            Artifact pomArtifact = new SubArtifact(jarArtifact, classifier, "pom");
            pomArtifact = pomArtifact.setFile(pomFile);
            installRequest = installRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
        } else {
            Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, classifier, "pom", version);
            pomArtifact = pomArtifact.setFile(pomFile);
            installRequest = installRequest.addArtifact(pomArtifact);
        }
        repositorySystem.install(getRepositorySystemSession(), installRequest);
    }
View Full Code Here

        if(artifactFile!=null) {
            String name = artifactFile.getName();
            String type = name.substring(artifactFile.getName().lastIndexOf(".")+1, name.length());
            Artifact jarArtifact = new DefaultArtifact(groupId, artifactId, classifier, type, version);
            jarArtifact = jarArtifact.setFile(artifactFile);
            Artifact pomArtifact = new SubArtifact(jarArtifact, classifier, "pom");
            pomArtifact = pomArtifact.setFile(pomFile);
            deployRequest = deployRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
        } else {
            Artifact pomArtifact = new DefaultArtifact(groupId, artifactId, classifier, "pom", version);
            pomArtifact = pomArtifact.setFile(pomFile);
            deployRequest = deployRequest.addArtifact(pomArtifact);
        }

        RemoteRepository repository = new RemoteRepository.Builder(repositoryId, "default", repositoryURL).build();
View Full Code Here

TOP

Related Classes of org.eclipse.aether.util.artifact.SubArtifact

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.