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
20 changed files
with
415 additions
and
452 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
41 changes: 41 additions & 0 deletions
41
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,41 @@ | ||
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 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) { | ||
String groupId = artifact.getGroupId(); | ||
String artifactId = artifact.getArtifactId(); | ||
String version = artifact.getTimestampVersion(); | ||
|
||
Optional<ArtifactType> artifactType = ofNullable(artifact.getType()) | ||
.map(mavenSession.getRepositorySession().getArtifactTypeRegistry()::get); | ||
return new org.eclipse.aether.artifact.DefaultArtifact( | ||
groupId, | ||
artifactId, | ||
ofNullable(artifact.getClassifier()) | ||
.orElse(artifactType.map(ArtifactType::getClassifier).orElse(null)), | ||
artifactType.map(ArtifactType::getExtension).orElse(null), | ||
version, | ||
artifactType.orElse(null)); | ||
} | ||
} |
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
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.