Skip to content

Commit

Permalink
Don't check javaVersion when execution is skipped
Browse files Browse the repository at this point in the history
This fixes #83
  • Loading branch information
Peter Lamby authored and gaul committed Jan 14, 2019
1 parent c2aff1a commit e3c8cf2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
import org.xml.sax.SAXException;

@Mojo(name = "modernizer", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES,
Expand Down Expand Up @@ -75,7 +76,7 @@ public final class ModernizerMojo extends AbstractMojo {
* Modernizer will detect uses of Vector as violations when targeting Java
* 1.2 but not when targeting Java 1.1.
*/
@Parameter(required = true, property = "modernizer.javaVersion")
@Parameter(property = "modernizer.javaVersion")
private String javaVersion;

/** Fail phase if Modernizer detects any violations. */
Expand Down Expand Up @@ -181,6 +182,11 @@ public void execute() throws MojoExecutionException {
return;
}

if (StringUtils.isEmpty(javaVersion)) {
throw new MojoExecutionException(
"javaVersion is not set but is required for execution.");
}

Map<String, Violation> allViolations = parseViolations(violationsFile);
for (String violationsFilePath : violationsFiles) {
allViolations.putAll(parseViolations(violationsFilePath));
Expand Down

0 comments on commit e3c8cf2

Please sign in to comment.