Package org.eclipse.aether.artifact

Examples of org.eclipse.aether.artifact.DefaultArtifact


            final Model model = xpp3Reader.read(reader);

            // Make the deployer deploy the pom itself.
            final DeployRequest artifactInstallRequest = new DeployRequest();
            artifactInstallRequest.setRepository(remoteRepository);
            Artifact pomArtifact = new DefaultArtifact(
                    model.getGroupId(), model.getArtifactId(), "pom", model.getVersion());
            pomArtifact = pomArtifact.setFile(pomFile);
            artifactInstallRequest.addArtifact(pomArtifact);

            // Add any additional files to this installation.
            final String artifactBaseName = model.getArtifactId() + "-" + model.getVersion();
            final File artifactFiles[] = artifactDirectory.listFiles(new ArtifactFilter());
            for (final File artifactFile : artifactFiles) {
                final String fileName = artifactFile.getName();

                // Handle the case that some file might not start with the base-name.
                if(!fileName.startsWith(artifactBaseName)) {
                    continue;
                }

                final String classifier;
                // This file has a classifier.
                if (fileName.charAt(artifactBaseName.length()) == '-') {
                    classifier = fileName.substring(artifactBaseName.length() + 1,
                            fileName.indexOf(".", artifactBaseName.length()));
                }
                // This file doesn't have a classifier.
                else {
                    classifier = "";
                }
                final String extension = fileName.substring(
                        artifactBaseName.length() + 1 + ((classifier.length() > 0) ? classifier.length() + 1 : 0));
                Artifact fileArtifact = new DefaultArtifact(model.getGroupId(), model.getArtifactId(),
                        classifier, extension, model.getVersion());
                fileArtifact = fileArtifact.setFile(artifactFile);
                artifactInstallRequest.addArtifact(fileArtifact);
            }

            // Actually install the artifact.
            System.out.println("Installing Artifact: " + pomArtifact.getGroupId() + ":" +
View Full Code Here


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

        //JAR Artifact
        Artifact jarArtifact = new DefaultArtifact( gav.getGroupId(),
                                                    gav.getArtifactId(),
                                                    "jar",
                                                    gav.getVersion() );
        jarArtifact = jarArtifact.setFile( jarFile );

        //pom.xml Artifact
        Artifact pomXMLArtifact = new SubArtifact( jarArtifact,
                                                   "",
                                                   "pom" );
View Full Code Here

            final Model model = xpp3Reader.read(reader);

            // Make the deployer deploy the pom itself.
            final DeployRequest artifactInstallRequest = new DeployRequest();
            artifactInstallRequest.setRepository(remoteRepository);
            Artifact pomArtifact = new DefaultArtifact(
                    model.getGroupId(), model.getArtifactId(), "pom", model.getVersion());
            pomArtifact = pomArtifact.setFile(pomFile);
            artifactInstallRequest.addArtifact(pomArtifact);

            // Add any additional files to this installation.
            final String artifactBaseName = model.getArtifactId() + "-" + model.getVersion();
            final File artifactFiles[] = artifactDirectory.listFiles(new ArtifactFilter());
            for (final File artifactFile : artifactFiles) {
                final String fileName = artifactFile.getName();
                final String classifier;
                // This file has a classifier.
                if (fileName.charAt(artifactBaseName.length()) == '-') {
                    classifier = fileName.substring(artifactBaseName.length() + 1,
                            fileName.indexOf(".", artifactBaseName.length()));
                }
                // This file doesn't have a classifier.
                else {
                    classifier = "";
                }
                final String extension = fileName.substring(
                        artifactBaseName.length() + 1 + ((classifier.length() > 0) ? classifier.length() + 1 : 0));
                Artifact fileArtifact = new DefaultArtifact(model.getGroupId(), model.getArtifactId(),
                        classifier, extension, model.getVersion());
                fileArtifact = fileArtifact.setFile(artifactFile);
                artifactInstallRequest.addArtifact(fileArtifact);
            }

            // Actually install the artifact.
            System.out.println("Installing Artifact: " + pomArtifact.getGroupId() + ":" +
View Full Code Here

   {
      RepositorySystem system = container.getRepositorySystem();
      Settings settings = getSettings();
      DefaultRepositorySystemSession session = container.setupRepoSession(system, settings);
      final String mavenCoords = toMavenCoords(addonId);
      Artifact queryArtifact = new DefaultArtifact(mavenCoords);
      session.setDependencyTraverser(new AddonDependencyTraverser(classifier));
      session.setDependencySelector(new AddonDependencySelector(classifier));
      Dependency dependency = new Dependency(queryArtifact, null);

      List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
View Full Code Here

   private Response<String> resolveAPIVersion(AddonId addonId, RepositorySystem system, Settings settings,
            DefaultRepositorySystemSession session)
   {
      List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
      String mavenCoords = toMavenCoords(addonId);
      Artifact queryArtifact = new DefaultArtifact(mavenCoords);

      session.setDependencyTraverser(new AddonDependencyTraverser(classifier));
      session.setDependencySelector(new DependencySelector()
      {
View Full Code Here

         else if (!version.matches("(\\(|\\[).*?(\\)|\\])"))
         {
            version = "[" + version + "]";
         }

         Artifact artifact = new DefaultArtifact(toMavenCoords(AddonId.from(addonName, version)));
         VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, repositories, null);
         VersionRangeResult rangeResult = system.resolveVersionRange(session, rangeRequest);
         return rangeResult;
      }
      catch (Exception e)
View Full Code Here

   private DependencyNode traverseAddonGraph(String coords, RepositorySystem system, Settings settings,
            DefaultRepositorySystemSession session)
   {
      session.setDependencyTraverser(new AddonDependencyTraverser(this.classifier));
      session.setDependencySelector(new AddonDependencySelector(this.classifier));
      Artifact queryArtifact = new DefaultArtifact(coords);

      List<RemoteRepository> repositories = MavenRepositories.getRemoteRepositories(container, settings);
      CollectRequest collectRequest = new CollectRequest(new Dependency(queryArtifact, null), repositories);

      CollectResult result;
View Full Code Here

    @Requirement
    private RepositorySystem repoSystem;

    private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
    {
        return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), null, "jar", plugin.getVersion(),
                                    session.getArtifactTypeRegistry().get( "maven-plugin" ) );
    }
View Full Code Here

    @Override
    public ModelSource resolveModel( String groupId, String artifactId, String version )
        throws UnresolvableModelException
    {
        Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );

        try
        {
            ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context );
            request.setTrace( trace );
            pomArtifact = resolver.resolveArtifact( session, request ).getArtifact();
        }
        catch ( ArtifactResolutionException e )
        {
            throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e );
        }

        File pomFile = pomArtifact.getFile();

        return new FileModelSource( pomFile );
    }
View Full Code Here

    }

    public ModelSource resolveModel( Parent parent )
        throws UnresolvableModelException
    {
        Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
                                                 parent.getVersion() );

        VersionRangeRequest versionRangeRequest = new VersionRangeRequest( artifact, repositories, context );
        versionRangeRequest.setTrace( trace );
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.