diff --git a/liberty-maven-plugin/pom.xml b/liberty-maven-plugin/pom.xml
index 4b3065125..81d246a3a 100644
--- a/liberty-maven-plugin/pom.xml
+++ b/liberty-maven-plugin/pom.xml
@@ -10,6 +10,7 @@
liberty-maven-plugin
+ 3.11-skipInitCompile
maven-plugin
liberty-maven-plugin
Liberty Maven Plugin : Install, Start/Stop, Package, Create Server, Deploy/Undeploy applications
@@ -88,7 +89,7 @@
io.openliberty.tools
ci.common
- 1.8.30
+ 1.8.31-skipInitCompile
org.twdata.maven
diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java
index ba7c31072..b873b64be 100644
--- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java
+++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java
@@ -345,14 +345,14 @@ public DevMojoUtil(File installDir, File userDir, File serverDirectory, File sou
List resourceDirs, JavaCompilerOptions compilerOptions, String mavenCacheLocation,
List upstreamProjects, List upstreamMavenProjects, boolean recompileDeps,
File pom, Map> parentPoms, boolean generateFeatures, boolean skipInstallFeature,
- Set compileArtifactPaths, Set testArtifactPaths, List webResourceDirs) throws IOException, PluginExecutionException {
+ Set compileArtifactPaths, Set testArtifactPaths, List webResourceDirs, boolean compileMojoError) throws IOException, PluginExecutionException {
super(new File(project.getBuild().getDirectory()), serverDirectory, sourceDirectory, testSourceDirectory,
configDirectory, projectDirectory, multiModuleProjectDirectory, resourceDirs, hotTests, skipTests,
skipUTs, skipITs, skipInstallFeature, project.getArtifactId(), serverStartTimeout, verifyTimeout, verifyTimeout,
((long) (compileWait * 1000L)), libertyDebug, false, false, pollingTest, container, containerfile,
containerBuildContext, containerRunOpts, containerBuildTimeout, skipDefaultPorts, compilerOptions,
keepTempContainerfile, mavenCacheLocation, upstreamProjects, recompileDeps, project.getPackaging(),
- pom, parentPoms, generateFeatures, compileArtifactPaths, testArtifactPaths, webResourceDirs);
+ pom, parentPoms, generateFeatures, compileArtifactPaths, testArtifactPaths, webResourceDirs,compileMojoError);
this.libertyDirPropertyFiles = BasicSupport.getLibertyDirectoryPropertyFiles(installDir, userDir,
serverDirectory);
@@ -1258,6 +1258,8 @@ private boolean isUsingBoost() {
}
private void doDevMode() throws MojoExecutionException {
+ boolean compileMojoError = false;
+
String mvnVersion = runtime.getMavenVersion();
getLog().debug("Maven version: " + mvnVersion);
// Maven 3.8.2 and 3.8.3 contain a bug where compile artifacts are not resolved
@@ -1365,7 +1367,11 @@ private void doDevMode() throws MojoExecutionException {
getLog().debug("Skipping compile/resources on module with pom packaging type");
} else {
runMojo("org.apache.maven.plugins", "maven-resources-plugin", "resources");
- runCompileMojoLogWarning();
+ try {
+ runCompileMojoLogWarningWithException();
+ } catch (MojoExecutionException e) {
+ compileMojoError = true;
+ }
runMojo("org.apache.maven.plugins", "maven-resources-plugin", "testResources");
runTestCompileMojoLogWarning();
}
@@ -1519,7 +1525,7 @@ private void doDevMode() throws MojoExecutionException {
util = new DevMojoUtil(installDirectory, userDirectory, serverDirectory, sourceDirectory, testSourceDirectory,
configDirectory, project.getBasedir(), multiModuleProjectDirectory, resourceDirs, compilerOptions,
settings.getLocalRepository(), upstreamProjects, upstreamMavenProjects, recompileDeps, pom, parentPoms,
- generateFeatures, skipInstallFeature, compileArtifactPaths, testArtifactPaths, webResourceDirs);
+ generateFeatures, skipInstallFeature, compileArtifactPaths, testArtifactPaths, webResourceDirs, compileMojoError);
} catch (IOException | PluginExecutionException |DependencyResolutionRequiredException e) {
throw new MojoExecutionException("Error initializing dev mode.", e);
}
@@ -1932,6 +1938,24 @@ private void runCompileMojoLogWarning() throws MojoExecutionException {
runCompileMojo("compile", project);
updateArtifactPathToOutputDirectory(project);
}
+
+ private void runCompileMojoLogWarningWithException() throws MojoExecutionException {
+
+ String goal = "compile";
+
+ Plugin plugin = getPluginForProject("org.apache.maven.plugins", "maven-compiler-plugin", project);
+ MavenSession tempSession = session.clone();
+ tempSession.setCurrentProject(project);
+ MavenProject tempProject = project;
+ Xpp3Dom config = ExecuteMojoUtil.getPluginGoalConfig(plugin, goal, getLog());
+ config = Xpp3Dom.mergeXpp3Dom(configuration(element(name("failOnError"), "true")), config);
+ getLog().info("Running maven-compiler-plugin:" + goal + " on " + tempProject.getFile());
+ getLog().debug("configuration:\n" + config);
+ executeMojo(plugin, goal(goal), config, executionEnvironment(tempProject, tempSession, pluginManager));
+
+ updateArtifactPathToOutputDirectory(project);
+ }
+
/**
* Executes maven:compile but logs errors as warning messages