Author: rombert Date: Tue Jul 19 15:20:43 2016 New Revision: 1753398 URL: http://svn.apache.org/viewvc?rev=1753398&view=rev Log: SLING-5863 - Make the sightly-maven-plugin m2e compatible
Prevent pom.xml from being decorated with error markers when errors or warnings are found. Modified: sling/trunk/tooling/maven/sightly-maven-plugin/src/main/java/org/apache/sling/maven/sightly/ValidateMojo.java Modified: sling/trunk/tooling/maven/sightly-maven-plugin/src/main/java/org/apache/sling/maven/sightly/ValidateMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/sightly-maven-plugin/src/main/java/org/apache/sling/maven/sightly/ValidateMojo.java?rev=1753398&r1=1753397&r2=1753398&view=diff ============================================================================== --- sling/trunk/tooling/maven/sightly-maven-plugin/src/main/java/org/apache/sling/maven/sightly/ValidateMojo.java (original) +++ sling/trunk/tooling/maven/sightly-maven-plugin/src/main/java/org/apache/sling/maven/sightly/ValidateMojo.java Tue Jul 19 15:20:43 2016 @@ -116,7 +116,10 @@ public class ValidateMojo extends Abstra getLog().info("No files found to validate, skipping"); return; } - + + // don't fail execution in Eclipse as it generates an error marker in the POM file, which is not desired + boolean mayFailExecution = !buildContext.getClass().getName().startsWith("org.eclipse.m2e"); + sourceDirectoryLength = sourceDirectory.getAbsolutePath().length(); processedIncludes = processIncludes(); processedExcludes = processExcludes(); @@ -160,10 +163,10 @@ public class ValidateMojo extends Abstra getLog().info("Processed " + processedFiles.size() + " files in " + ( System.currentTimeMillis() - start ) + " milliseconds"); - if (hasWarnings && failOnWarnings) { + if (mayFailExecution && hasWarnings && failOnWarnings) { throw new MojoFailureException("Compilation warnings were configured to fail the build."); } - if (hasErrors) { + if (mayFailExecution && hasErrors) { throw new MojoFailureException("Please check the reported syntax errors."); } } catch (IOException e) {