Class MavenUtil


  • public class MavenUtil
    extends Object
    Util method for Maven manipulation (URL convert, metadata generation, etc).
    • Constructor Detail

      • MavenUtil

        public MavenUtil()
    • Method Detail

      • mvnToAether

        public static String mvnToAether​(String name)
        Convert PAX URL mvn format to aether coordinate format. N.B. we do not handle repository-url in mvn urls. N.B. version is required in mvn urls.
        Parameters:
        name - PAX URL mvn format: mvn-uri := [ 'wrap:' ] 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
        Returns:
        aether coordinate format: <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
      • mvnToArtifact

        public static org.eclipse.aether.artifact.DefaultArtifact mvnToArtifact​(String name)
        Convert PAX URL mvn format to an aether Artifact. N.B. we do not handle repository-url in mvn urls. N.B. version is required in mvn urls.
        Parameters:
        name - PAX URL mvn format: mvn-uri := [ 'wrap:' ] 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
        Returns:
        aether Artifact
      • aetherToArtifact

        public static org.eclipse.aether.artifact.DefaultArtifact aetherToArtifact​(String name)
        Convert Aether coordinate format to an aether Artifact. N.B. we do not handle repository-url in mvn urls. N.B. version is required in mvn urls.
        Parameters:
        name - aether coordinate format: <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
        Returns:
        aether Artifact
      • aetherToMvn

        public static String aetherToMvn​(String name)
        Convert Aether coordinate format to PAX mvn format. N.B. we do not handle repository-url in mvn urls. N.B. version is required in mvn urls.
        Parameters:
        name - aether coordinate format: <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
        Returns:
        PAX URL mvn format: mvn-uri := 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
      • isEmpty

        public static boolean isEmpty​(String classifier)
      • generateMavenMetadata

        public static void generateMavenMetadata​(org.apache.maven.artifact.Artifact artifact,
                                                 File target)
                                          throws IOException
        Generate the maven-metadata-local.xml for the given Maven Artifact.
        Parameters:
        artifact - the Maven Artifact.
        target - the target maven-metadata-local.xml file to generate.
        Throws:
        IOException - if the maven-metadata-local.xml can't be generated.
      • getFileName

        public static String getFileName​(org.apache.maven.artifact.Artifact artifact,
                                         boolean timestampedSnapshot)
      • getDir

        public static String getDir​(org.apache.maven.artifact.Artifact artifact)
      • remoteRepositoryList

        public static String remoteRepositoryList​(List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)
        Changes maven configuration of remote repositories to a list of repositories for pax-url-aether
        Parameters:
        remoteRepositories -
        Returns: