Package org.eclipse.aether.artifact

Examples of org.eclipse.aether.artifact.DefaultArtifact


    }
  }

  private Artifact resolveLatestArtifact(FqPackageName name)
          throws VersionRangeResolutionException {
    Artifact artifact = new DefaultArtifact(name.getGroupId(), name.getPackageName(), "jar", "[0,)");
    Version newestVersion = resolveLatestVersion(artifact);
    if (newestVersion == null) {
      return null;
    }
    return artifact.setVersion(newestVersion.toString());
  }
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
      {
         final ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null);
         pomArtifact = system.resolveArtifact(session, request).getArtifact();

      }
      catch (ArtifactResolutionException e)
      {
         throw new UnresolvableModelException("Failed to resolve POM for " + groupId + ":" + artifactId + ":"
                  + version + " due to " + e.getMessage(), groupId, artifactId, version, e);
      }

      final File pomFile = pomArtifact.getFile();

      return new FileModelSource(pomFile);

   }
View Full Code Here

         if (version == null || version.isEmpty())
         {
            version = pom.getTextValueForPatternName("parent/version");
         }

         final Artifact foundArtifact = new DefaultArtifact(groupId, artifactId, type, version);
         foundArtifact.setFile(pomFile);
         return foundArtifact;
      }
      catch (final Exception e)
      {
         throw new RuntimeException("Could not parse pom.xml: " + pomFile, e);
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
      {
         final ArtifactRequest request = new ArtifactRequest(pomArtifact, repositories, null);
         pomArtifact = system.resolveArtifact(session, request).getArtifact();

      }
      catch (ArtifactResolutionException e)
      {
         throw new UnresolvableModelException("Failed to resolve POM for " + groupId + ":" + artifactId + ":"
                  + version + " due to " + e.getMessage(), groupId, artifactId, version, e);
      }

      final File pomFile = pomArtifact.getFile();

      return new FileModelSource(pomFile);

   }
View Full Code Here

      return remoteRepos;
   }

   public static Artifact coordinateToMavenArtifact(final Coordinate dep)
   {
      Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getClassifier(),
               dep.getPackaging() == null ? "jar" : dep.getPackaging(), dep.getVersion());
      return artifact;
   }
View Full Code Here

        final ArtifactResult result;
        try {
            ProjectBuildingRequest projectBuildingRequest = invoke(project, "getProjectBuildingRequest", ProjectBuildingRequest.class);

            final ArtifactRequest request = new ArtifactRequest();
            final DefaultArtifact defaultArtifact = createArtifact(artifact);
            request.setArtifact(defaultArtifact);
            @SuppressWarnings("unchecked")
            final List<RemoteRepository> repos = invoke(project, "getRemoteProjectRepositories", List.class);
            request.setRepositories(repos);
            result = repoSystem.resolveArtifact(invoke(projectBuildingRequest, "getRepositorySession", RepositorySystemSession.class), request);
View Full Code Here

        return result.getArtifact().getFile();
    }

    @Override
    protected DefaultArtifact constructArtifact(final String groupId, final String artifactId, final String classifier, final String packaging, final String version) {
        return new DefaultArtifact(groupId, artifactId, classifier, packaging, version);
    }
View Full Code Here

    public static MavenRepository getMavenRepository(MavenProject mavenProject) {
        return new MavenRepository(new Aether(mavenProject));
    }

    public List<DependencyDescriptor> getArtifactDependecies(String artifactName) {
        Artifact artifact = new DefaultArtifact( artifactName );
        CollectRequest collectRequest = new CollectRequest();
        Dependency root = new Dependency( artifact, "" );
        collectRequest.setRoot( root );
        for (RemoteRepository repo : remoteRepositoriesForRequest) {
            collectRequest.addRepository(repo);
View Full Code Here

    public Artifact resolveArtifact(String artifactName) {
        return resolveArtifact(artifactName, true);
    }

    public Artifact resolveArtifact(String artifactName, boolean logUnresolvedArtifact) {
        Artifact artifact = new DefaultArtifact( artifactName );
        ArtifactRequest artifactRequest = new ArtifactRequest();
        artifactRequest.setArtifact( artifact );
        for (RemoteRepository repo : remoteRepositoriesForRequest) {
            artifactRequest.addRepository(repo);
        }
View Full Code Here

            return null;
        }
    }

    public Version resolveVersion(String artifactName) {
        Artifact artifact = new DefaultArtifact( artifactName );
        VersionRangeRequest versionRequest = new VersionRangeRequest();
        versionRequest.setArtifact(artifact);
        for (RemoteRepository repo : remoteRepositoriesForRequest) {
            versionRequest.addRepository(repo);
        }
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.