mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Always compile quarkus:dev
This commit is contained in:
committed by
Georgios Andrianakis
parent
49b4b003e0
commit
c146b7e536
@@ -237,6 +237,10 @@ public class DevMojo extends AbstractMojo {
|
||||
public void execute() throws MojoFailureException, MojoExecutionException {
|
||||
|
||||
mavenVersionEnforcer.ensureMavenVersion(getLog(), session);
|
||||
|
||||
//we always want to compile if needed, so if it is run from the parent it will compile dependent projects
|
||||
handleAutoCompile();
|
||||
|
||||
Plugin pluginDef = MojoUtils.checkProjectForMavenBuildPlugin(project);
|
||||
|
||||
if (pluginDef == null) {
|
||||
@@ -249,34 +253,6 @@ public class DevMojo extends AbstractMojo {
|
||||
if (!sourceDir.isDirectory()) {
|
||||
getLog().warn("The project's sources directory does not exist " + sourceDir);
|
||||
}
|
||||
//we check to see if there was a compile (or later) goal before this plugin
|
||||
boolean compileNeeded = true;
|
||||
for (String goal : session.getGoals()) {
|
||||
if (POST_COMPILE_PHASES.contains(goal)) {
|
||||
compileNeeded = false;
|
||||
break;
|
||||
}
|
||||
if (goal.endsWith("quarkus:dev")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if the user did not compile we run it for them
|
||||
if (compileNeeded) {
|
||||
// compile the Kotlin sources if needed
|
||||
final String kotlinMavenPluginKey = ORG_JETBRAINS_KOTLIN + ":" + KOTLIN_MAVEN_PLUGIN;
|
||||
final Plugin kotlinMavenPlugin = project.getPlugin(kotlinMavenPluginKey);
|
||||
if (kotlinMavenPlugin != null) {
|
||||
executeCompileGoal(kotlinMavenPlugin, ORG_JETBRAINS_KOTLIN, KOTLIN_MAVEN_PLUGIN);
|
||||
}
|
||||
|
||||
// Compile the Java sources if needed
|
||||
final String compilerPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_COMPILER_PLUGIN;
|
||||
final Plugin compilerPlugin = project.getPlugin(compilerPluginKey);
|
||||
if (compilerPlugin != null) {
|
||||
executeCompileGoal(compilerPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_COMPILER_PLUGIN);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
List<String> args = new ArrayList<>();
|
||||
@@ -361,6 +337,37 @@ public class DevMojo extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAutoCompile() throws MojoExecutionException {
|
||||
//we check to see if there was a compile (or later) goal before this plugin
|
||||
boolean compileNeeded = true;
|
||||
for (String goal : session.getGoals()) {
|
||||
if (POST_COMPILE_PHASES.contains(goal)) {
|
||||
compileNeeded = false;
|
||||
break;
|
||||
}
|
||||
if (goal.endsWith("quarkus:dev")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if the user did not compile we run it for them
|
||||
if (compileNeeded) {
|
||||
// compile the Kotlin sources if needed
|
||||
final String kotlinMavenPluginKey = ORG_JETBRAINS_KOTLIN + ":" + KOTLIN_MAVEN_PLUGIN;
|
||||
final Plugin kotlinMavenPlugin = project.getPlugin(kotlinMavenPluginKey);
|
||||
if (kotlinMavenPlugin != null) {
|
||||
executeCompileGoal(kotlinMavenPlugin, ORG_JETBRAINS_KOTLIN, KOTLIN_MAVEN_PLUGIN);
|
||||
}
|
||||
|
||||
// Compile the Java sources if needed
|
||||
final String compilerPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_COMPILER_PLUGIN;
|
||||
final Plugin compilerPlugin = project.getPlugin(compilerPluginKey);
|
||||
if (compilerPlugin != null) {
|
||||
executeCompileGoal(compilerPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_COMPILER_PLUGIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void executeCompileGoal(Plugin plugin, String groupId, String artifactId) throws MojoExecutionException {
|
||||
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
|
||||
if (configuration == null) {
|
||||
|
||||
Reference in New Issue
Block a user