Class MojoUtils

java.lang.Object
io.quarkus.maven.utilities.MojoUtils

public class MojoUtils extends Object
Author:
kameshs
  • Field Details

    • JAVA_FILE_EXTENSION

      public static final String JAVA_FILE_EXTENSION
      See Also:
    • KOTLIN_FILE_EXTENSION

      public static final String KOTLIN_FILE_EXTENSION
      See Also:
    • SCALA_FILE_EXTENSION

      public static final String SCALA_FILE_EXTENSION
      See Also:
    • JAVA_EXTENSION_NAME

      public static final String JAVA_EXTENSION_NAME
      See Also:
    • KOTLIN_EXTENSION_NAME

      public static final String KOTLIN_EXTENSION_NAME
      See Also:
    • SCALA_EXTENSION_NAME

      public static final String SCALA_EXTENSION_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_VERSION_NAME

      public static final String TEMPLATE_PROPERTY_QUARKUS_VERSION_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_VERSION_VALUE

      public static final String TEMPLATE_PROPERTY_QUARKUS_VERSION_VALUE
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_NAME

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_VALUE

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_VALUE
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_NAME

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_VALUE

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_VALUE
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_NAME

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_VALUE

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_VALUE
    • TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_NAME

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_NAME
      See Also:
    • TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_VALUE

      public static final String TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_VALUE
  • Method Details

    • muteTransferListener

      public static org.eclipse.aether.RepositorySystemSession muteTransferListener(org.eclipse.aether.RepositorySystemSession session)
    • hasDependency

      public static boolean hasDependency(org.apache.maven.model.Model model, String groupId, String artifactId)
      Checks whether the project has the dependency
      Parameters:
      model - - the project to check existence of dependency
      groupId - - the dependency groupId
      artifactId - - the dependency artifactId
      Returns:
      true if the project has the dependency
    • parse

      public static org.apache.maven.model.Dependency parse(String dependency)
    • configuration

      public static org.codehaus.plexus.util.xml.Xpp3Dom configuration(MojoUtils.Element... elements)
      Builds the configuration for the goal using Elements
      Parameters:
      elements - A list of elements for the configuration section
      Returns:
      The elements transformed into the Maven-native XML format
    • plugin

      public static org.apache.maven.model.Plugin plugin(String groupId, String artifactId)
      Defines the plugin without its version or extensions.
      Parameters:
      groupId - The group id
      artifactId - The artifact id
      Returns:
      The plugin instance
    • plugin

      public static org.apache.maven.model.Plugin plugin(String groupId, String artifactId, String version)
      Defines a plugin without extensions.
      Parameters:
      groupId - The group id
      artifactId - The artifact id
      version - The plugin version
      Returns:
      The plugin instance
    • plugin

      public static org.apache.maven.model.Plugin plugin(String groupId, String artifactId, String version, List<org.apache.maven.model.Dependency> dependencies)
      Defines a plugin.
      Parameters:
      groupId - The group id
      artifactId - The artifact id
      version - The plugin version
      dependencies - The plugin extensions
      Returns:
      The plugin instance
    • readPom

      public static org.apache.maven.model.Model readPom(File pom) throws IOException
      Throws:
      IOException
    • readPom

      public static org.apache.maven.model.Model readPom(InputStream resourceAsStream) throws IOException
      Throws:
      IOException
    • readGavFromPom

      public static String[] readGavFromPom(InputStream resourceAsStream) throws IOException
      Throws:
      IOException
    • write

      public static void write(org.apache.maven.model.Model model, File outputFile) throws IOException
      Throws:
      IOException
    • writeFormatted

      public static void writeFormatted(org.apache.maven.model.Model model, File outputFile) throws IOException
      Throws:
      IOException
    • write

      public static void write(org.apache.maven.model.Model model, OutputStream fileOutputStream) throws IOException
      Throws:
      IOException
    • credentials

      public static String credentials(org.apache.maven.model.Dependency d)
    • readGavFromSettingsGradle

      public static String[] readGavFromSettingsGradle(ByteArrayInputStream buildFileInputStream, String[] gavIn)
    • getClassOrigin

      public static Path getClassOrigin(Class<?> cls) throws IOException
      Returns the JAR or the root directory that contains the class file that is on the classpath of the context classloader
      Throws:
      IOException
    • getResourceOrigin

      public static Path getResourceOrigin(ClassLoader cl, String name) throws IOException
      Throws:
      IOException