public class MojoUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
private static String |
A_MAVEN_COMPILER_PLUGIN |
private static String |
A_MAVEN_RESOURCES_PLUGIN |
private static String |
G_MAVEN_COMPILER_PLUGIN |
private static String |
G_MAVEN_RESOURCES_PLUGIN |
private static String |
GOAL_COMPILE |
private static String |
GOAL_RESOURCES |
private static Properties |
properties |
private static String |
RESOURCES_PLUGIN_KEY |
private static String |
V_MAVEN_COMPILER_PLUGIN |
private static String |
V_MAVEN_RESOURCES_PLUGIN |
| Modifier | Constructor and Description |
|---|---|
private |
MojoUtils() |
| Modifier and Type | Method and Description |
|---|---|
private static Optional<Xpp3Dom> |
buildConfiguration(MavenProject project,
String artifactId,
String goal) |
static void |
compile(MavenProject project,
MavenSession mavenSession,
BuildPluginManager buildPluginManager)
Execute the Maven Compiler Plugin to compile java sources.
|
static void |
copyResources(MavenProject project,
MavenSession mavenSession,
BuildPluginManager buildPluginManager)
Executes the Maven Resource Plugin to copy resources to `target/classes`
|
static String |
getVersion(String key) |
private static List<String> |
goals(Object goals) |
static boolean |
hasDependency(MavenProject project,
String groupId,
String artifactId)
Checks whether the project has the dependency
|
static Optional<org.apache.maven.model.Plugin> |
hasPlugin(MavenProject project,
String pluginKey)
Checks whether or not the given project has a plugin with the given key.
|
private static void |
loadProperties() |
private static final String RESOURCES_PLUGIN_KEY
private static final String G_MAVEN_RESOURCES_PLUGIN
private static final String A_MAVEN_RESOURCES_PLUGIN
private static final String V_MAVEN_RESOURCES_PLUGIN
private static final String G_MAVEN_COMPILER_PLUGIN
private static final String A_MAVEN_COMPILER_PLUGIN
private static final String V_MAVEN_COMPILER_PLUGIN
private static final String GOAL_COMPILE
private static final String GOAL_RESOURCES
private static final Properties properties
public static void copyResources(MavenProject project, MavenSession mavenSession, BuildPluginManager buildPluginManager) throws MojoExecutionException
project - the projectmavenSession - the maven sessionbuildPluginManager - the build plugin managerMojoExecutionException - if the copy cannot be completed successfullypublic static Optional<org.apache.maven.model.Plugin> hasPlugin(MavenProject project, String pluginKey)
project - the projectpluginKey - the pluginpublic static boolean hasDependency(MavenProject project, String groupId, String artifactId)
project - - the project to check existence of dependencygroupId - - the dependency groupIdartifactId - - the dependency artifactIdpublic static void compile(MavenProject project, MavenSession mavenSession, BuildPluginManager buildPluginManager) throws Exception
project - the projectmavenSession - the sessionbuildPluginManager - the build plugin managerException - if the compilation fails for any reasonprivate static Optional<Xpp3Dom> buildConfiguration(MavenProject project, String artifactId, String goal)
project - artifactId - goal - private static void loadProperties()
Copyright © 2018. All rights reserved.