public Artifact transformArtifact( Artifact artifact ) { if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) ) { Object key = RemoteSnapshotMetadata.getKey( artifact ); RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key ); if ( snapshotMetadata != null ) { artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) ); } } return artifact; }
public String getPathForLocalArtifact( Artifact artifact ) { if ( realLocalRepo ) { return delegate.pathOf( RepositoryUtils.toArtifact( artifact.setVersion( artifact.getBaseVersion() ) ) ); } return delegate.pathOf( RepositoryUtils.toArtifact( artifact ) ); }
art = art.setFile( null ).setVersion( art.getBaseVersion() ); dep = dep.setArtifact( art );
subRequest.setArtifact( artifact.setVersion( result.getVersion() ) ); if ( result.getRepository() instanceof RemoteRepository )
VersionResult versionResult = versionResolver.resolveVersion( session, versionRequest ); a = a.setVersion( versionResult.getVersion() ); versionResult = versionResolver.resolveVersion( session, versionRequest ); pomArtifact = pomArtifact.setVersion( versionResult.getVersion() );
@Override public Artifact setVersion(String version) { delegate = delegate.setVersion(version); return this; }
@Override public Artifact setVersion(String version) { return artifact.setVersion(version); }
public Artifact setVersion(String version) { Artifact artifact = delegate.setVersion(version); if (artifact != delegate) { return newInstance(artifact); } return this; }
public Artifact setVersion( String version ) { Artifact artifact = delegate.setVersion( version ); if ( artifact != delegate ) { return newInstance( artifact ); } return this; }
public Artifact setVersion( String version ) { Artifact artifact = delegate.setVersion( version ); if ( artifact != delegate ) { return newInstance( artifact ); } return this; }
public Artifact transformArtifact( Artifact artifact ) { if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) ) { Object key = RemoteSnapshotMetadata.getKey( artifact ); RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key ); if ( snapshotMetadata != null ) { artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) ); } } return artifact; }
public String latestRelease(Artifact artifact) throws VersionRangeResolutionException { List<Version> versions; Version version; versions = availableVersions(artifact.setVersion("[" + artifact.getVersion() + ",]")); // ranges also return SNAPSHOTS. The release/compatibility notes say they don't, but the respective bug // was re-opened: http://jira.codehaus.org/browse/MNG-3092 for (int i = versions.size() - 1; i >= 0; i--) { version = versions.get(i); if (!version.toString().endsWith("SNAPSHOT")) { return version.toString(); } } return artifact.getVersion(); }
private Artifact resolveLatestVersionRange(Dependency dependency, String version) throws MojoExecutionException { Matcher versionMatch = matchVersion(version); Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getType(), version); if (versionMatch.matches()) { Version highestVersion = highestVersion(artifact); String upperVersion = versionMatch.group(1) != null ? versionMatch.group(1) : ""; String newVersion = "[" + highestVersion.toString() + "," + upperVersion + ")"; artifact = artifact.setVersion(newVersion); return artifact; } else { return artifact; } }
public Artifact transformArtifact( Artifact artifact ) { if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) ) { Object key = RemoteSnapshotMetadata.getKey( artifact ); RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key ); if ( snapshotMetadata != null ) { artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) ); } } return artifact; }
public Artifact transformArtifact( Artifact artifact ) { if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) ) { Object key = RemoteSnapshotMetadata.getKey( artifact ); RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key ); if ( snapshotMetadata != null ) { artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) ); } } return artifact; }
Artifact resolveLatestVersionRange(Dependency dependency, String version) throws MojoExecutionException { Matcher versionMatch = matchVersion(version); if (versionMatch.matches()) { Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getType(), version.replaceFirst(versionMatch.group(1), ",")); Version highestVersion = highestVersion(artifact); String newVersion = "[" + highestVersion.toString() + "," + majorVersionPlusOne(highestVersion) + ")"; return artifact.setVersion(newVersion); } else { return new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getType(), version); } }
private Artifact resolveVersion(Artifact artifact, List<RemoteRepository> repositories, RepositorySystemSession session) throws VersionResolutionException { Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact(artifact); VersionRequest versionRequest = new VersionRequest(artifact, repositories, ""); VersionResult versionResult = this.versionResolver.resolveVersion(session, versionRequest); return pomArtifact.setVersion(versionResult.getVersion()); }
public String nextVersion(Artifact artifact) throws RepositoryException { if (artifact.isSnapshot()) { return latestSnapshot(artifact.setVersion(artifact.getBaseVersion())); } else { return latestRelease(artifact); } }
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()); }
/** * Create and save downloaded OArtifact from server * @param artifact - downloaded {@link Artifact} from server * @param reference - {@link OArtifactReference} of OArtifact */ private void saveOArtifact(Artifact artifact, OArtifactReference reference) { OArtifact ooArtifact = new OArtifact(); ooArtifact.setTrusted(trusted); ooArtifact.setLoad(true); ooArtifact.setDownloaded(true); OArtifactReference oArtifactReference = OArtifactReference.valueOf(artifact.setVersion(reference.getVersion())); oArtifactReference.setDescription(reference.getDescription()); ooArtifact.setArtifactReference(oArtifactReference); OrienteerClassLoaderUtil.updateOArtifactInMetadata(ooArtifact); }