Package io.quarkus.maven.utilities
Class MojoUtils
- java.lang.Object
-
- io.quarkus.maven.utilities.MojoUtils
-
public class MojoUtils extends Object
- Author:
- kameshs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMojoUtils.AttributeAttribute wrapper classstatic classMojoUtils.AttributesCollection of attributes wrapper classstatic classMojoUtils.ElementElement wrapper class for configuration elements
-
Field Summary
Fields Modifier and Type Field Description static StringJAVA_EXTENSION_NAMEstatic StringJAVA_FILE_EXTENSIONstatic StringKOTLIN_EXTENSION_NAMEstatic StringKOTLIN_FILE_EXTENSIONstatic StringSCALA_EXTENSION_NAMEstatic StringSCALA_FILE_EXTENSIONstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_NAMEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_VALUEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_NAMEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_VALUEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_NAMEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLATFORM_VERSION_VALUEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_NAMEstatic StringTEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_VALUEstatic StringTEMPLATE_PROPERTY_QUARKUS_VERSION_NAMEstatic StringTEMPLATE_PROPERTY_QUARKUS_VERSION_VALUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.codehaus.plexus.util.xml.Xpp3Domconfiguration(MojoUtils.Element... elements)Builds the configuration for the goal using Elementsstatic Stringcredentials(org.apache.maven.model.Dependency d)static PathgetClassOrigin(Class<?> cls)Returns the JAR or the root directory that contains the class file that is on the classpath of the context classloaderstatic PathgetResourceOrigin(ClassLoader cl, String name)static booleanhasDependency(org.apache.maven.model.Model model, String groupId, String artifactId)Checks whether the project has the dependencystatic org.eclipse.aether.RepositorySystemSessionmuteTransferListener(org.eclipse.aether.RepositorySystemSession session)static org.apache.maven.model.Dependencyparse(String dependency)static org.apache.maven.model.Pluginplugin(String groupId, String artifactId)Defines the plugin without its version or extensions.static org.apache.maven.model.Pluginplugin(String groupId, String artifactId, String version)Defines a plugin without extensions.static org.apache.maven.model.Pluginplugin(String groupId, String artifactId, String version, List<org.apache.maven.model.Dependency> dependencies)Defines a plugin.static String[]readGavFromPom(InputStream resourceAsStream)static String[]readGavFromSettingsGradle(ByteArrayInputStream buildFileInputStream, String[] gavIn)static org.apache.maven.model.ModelreadPom(File pom)static org.apache.maven.model.ModelreadPom(InputStream resourceAsStream)static voidwrite(org.apache.maven.model.Model model, File outputFile)static voidwrite(org.apache.maven.model.Model model, OutputStream fileOutputStream)
-
-
-
Field Detail
-
JAVA_FILE_EXTENSION
public static final String JAVA_FILE_EXTENSION
- See Also:
- Constant Field Values
-
KOTLIN_FILE_EXTENSION
public static final String KOTLIN_FILE_EXTENSION
- See Also:
- Constant Field Values
-
SCALA_FILE_EXTENSION
public static final String SCALA_FILE_EXTENSION
- See Also:
- Constant Field Values
-
JAVA_EXTENSION_NAME
public static final String JAVA_EXTENSION_NAME
- See Also:
- Constant Field Values
-
KOTLIN_EXTENSION_NAME
public static final String KOTLIN_EXTENSION_NAME
- See Also:
- Constant Field Values
-
SCALA_EXTENSION_NAME
public static final String SCALA_EXTENSION_NAME
- See Also:
- Constant Field Values
-
TEMPLATE_PROPERTY_QUARKUS_VERSION_NAME
public static final String TEMPLATE_PROPERTY_QUARKUS_VERSION_NAME
- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_VALUE
public static final String TEMPLATE_PROPERTY_QUARKUS_PLUGIN_VERSION_VALUE
-
-
Method Detail
-
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 dependencygroupId- - the dependency groupIdartifactId- - 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 idartifactId- 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 idartifactId- The artifact idversion- 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 idartifactId- The artifact idversion- The plugin versiondependencies- 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
-
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
-
-