Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aether-users] Resolving version range for secondary artifact

Hi, 

a conceptual question:

I've primary artifacts (jar files) in many versions in my repository. Some of these artifacts have attached artifacts like sources.jar or  zip-files with additional information.

For instance, we have several versions of jface:

  org.eclipse.jface:org.eclipse.jface:3.0.0
  org.eclipse.jface:org.eclipse.jface:3.6.0
  org.eclipse.jface:org.eclipse.jface:3.7.1

but only for a few of them we have additional artifacts attached. For example we have on artifact "org.eclipse.jface:org.eclipse.jface:zip:model:3.0.0" but no "model zips" for any other version.


Now, I'd like to issue a "highest-version" range query over the attached "model" artifact only. With the code below, I always get the highest version of the primary artifact, i.e, for the range request

  org.eclipse.jface:org.eclipse.jface:zip:models:[0,3.8.0)

it returns

  org.eclipse.jface:org.eclipse.jface:zip:models:3.7.1 

which does not exist. Any idea what I'm doing wrong here? Can I somehow limit the search to "zip:models" only?


private Optional<VersionRangeResult> resolveVersionRange(Artifact a) {
  VersionRangeRequest rangeRequest = new VersionRangeRequest().setArtifact(a).addRepository(remote);
  try {
    RepositorySystem system =...;
    return of(system.resolveVersionRange(newSession(), rangeRequest));
  } catch (Exception e) {
    log.error("Failed to find highest version for artifact " + a, e);
    return absent();
  }
}


Thanks,
Marcel

-- 
Eclipse Code Recommenders:
 w www.eclipse.org/recommenders
 tw www.twitter.com/marcelbruch
 g+ www.gplus.to/marcelbruch



Back to the top