Java Code Examples for org.eclipse.aether.artifact.Artifact#getBaseVersion()

The following examples show how to use org.eclipse.aether.artifact.Artifact#getBaseVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MavenAddonDependencyResolver.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
private String findVersion(List<DependencyNode> dependencies, String groupId, String artifactId)
{
   for (DependencyNode child : dependencies)
   {
      Artifact childArtifact = child.getArtifact();

      if (groupId.equals(childArtifact.getGroupId())
               && artifactId.equals(childArtifact.getArtifactId()))
      {
         return childArtifact.getBaseVersion();
      }
      else
      {
         String version = findVersion(child.getChildren(), groupId, artifactId);
         if (version != null)
         {
            return version;
         }
      }
   }
   return null;
}
 
Example 2
Source File: MavenArchive.java    From revapi with Apache License 2.0 5 votes vote down vote up
private MavenArchive(Artifact artifact) {
    if (artifact == null) {
        throw new IllegalArgumentException("Artifact cannot be null");
    }

    file = artifact.getFile();
    if (file == null) {
        throw new IllegalArgumentException("Could not locate the file of the maven artifact: " + artifact);
    }

    this.gav = artifact.toString();
    this.version = artifact.getBaseVersion();
}
 
Example 3
Source File: MavenAddonDependencyResolver.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
private String findDependencyVersion(List<Dependency> dependencies, String groupId, String artifactId)
{
   for (Dependency child : dependencies)
   {
      Artifact childArtifact = child.getArtifact();

      if (groupId.equals(childArtifact.getGroupId())
               && artifactId.equals(childArtifact.getArtifactId()))
      {
         return childArtifact.getBaseVersion();
      }
   }
   return null;
}
 
Example 4
Source File: IDEWorkspaceReader2.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public File findArtifact(Artifact artifact) {
    return super.findArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getExtension(), artifact.getClassifier());
}
 
Example 5
Source File: StackResolution.java    From vertx-stack with Apache License 2.0 2 votes vote down vote up
/**
 * Keep a trace of the resolution.
 *
 * @param dependency the dependency having triggered the resolution
 * @param artifact   the resolved artifact
 */
private void keepATrace(Dependency dependency, Artifact artifact) {
  String traceId = getManagementKey(artifact) + ":" + artifact.getBaseVersion();
  List<String> deps = traces.computeIfAbsent(traceId, k -> new ArrayList<>());
  deps.add(dependency.getGACV());
}