forked from mojohaus/mrm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mojohaus#99: First stage of maven 3 migration
Resolves mojohaus#143: migration to JSR330
- Loading branch information
Showing
19 changed files
with
460 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
mrm-api/src/main/java/org/codehaus/mojo/mrm/api/ResolverUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.codehaus.mojo.mrm.api; | ||
|
||
import java.util.Optional; | ||
|
||
import org.apache.maven.execution.MavenSession; | ||
import org.codehaus.mojo.mrm.api.maven.Artifact; | ||
import org.eclipse.aether.artifact.ArtifactType; | ||
|
||
import static java.util.Optional.ofNullable; | ||
|
||
/** | ||
* Miscellaneous utilities for manipulating Resolver entities | ||
*/ | ||
public class ResolverUtils { | ||
|
||
/** | ||
* <p>Creates a new {@link org.eclipse.aether.artifact.Artifact} based on an {@link Artifact} object.</p> | ||
* <p>Future deprecation: This method will be replaced with the new Maven 4 | ||
* {@code org.apache.maven.api.services.ArtifactFactory} once it becomes available.</p> | ||
* | ||
* @param mavenSession {@link MavenSession} instance, may not be {@code null} | ||
* @param groupId groupId of the artifact to create, may not be {@code null} | ||
* @param artifactId artifactId of the artifact to create, may not be {@code null} | ||
* @param classifier classifier of the artifact to create, may be {@code null} | ||
* @param type type of the artifact to create, may be {@code null} | ||
* @param version version of the artifact to create, may not be {@code null} | ||
* @return new {@link org.eclipse.aether.artifact.Artifact} instance | ||
*/ | ||
public static org.eclipse.aether.artifact.Artifact createArtifact( | ||
MavenSession mavenSession, | ||
String groupId, | ||
String artifactId, | ||
String classifier, | ||
String type, | ||
String version) { | ||
assert mavenSession != null; | ||
assert groupId != null; | ||
assert artifactId != null; | ||
assert version != null; | ||
|
||
Optional<ArtifactType> artifactType = | ||
ofNullable(type).map(mavenSession.getRepositorySession().getArtifactTypeRegistry()::get); | ||
return new org.eclipse.aether.artifact.DefaultArtifact( | ||
groupId, | ||
artifactId, | ||
ofNullable(classifier) | ||
.orElse(artifactType.map(ArtifactType::getClassifier).orElse(null)), | ||
artifactType.map(ArtifactType::getExtension).orElse(null), | ||
version, | ||
artifactType.orElse(null)); | ||
} | ||
|
||
/** | ||
* <p>Creates a new {@link org.eclipse.aether.artifact.Artifact} based on an {@link Artifact} object.</p> | ||
* <p>Future deprecation: This method will be replaced with the new Maven 4 | ||
* {@code org.apache.maven.api.services.ArtifactFactory} once it becomes available.</p> | ||
* | ||
* @param mavenSession {@link MavenSession} instance, may not be {@code null} | ||
* @param artifact object to read the data from, may not be {@code null} | ||
* @return new {@link org.eclipse.aether.artifact.Artifact} instance | ||
*/ | ||
public static org.eclipse.aether.artifact.Artifact createArtifact(MavenSession mavenSession, Artifact artifact) { | ||
return createArtifact( | ||
mavenSession, | ||
artifact.getGroupId(), | ||
artifact.getArtifactId(), | ||
artifact.getClassifier(), | ||
artifact.getType(), | ||
artifact.getTimestampVersion()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelperRequired.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.