From e08688f0f76e7038f0c4f6a51509d805f569acf6 Mon Sep 17 00:00:00 2001 From: Martin Mois Date: Fri, 3 Nov 2023 16:48:01 +0100 Subject: [PATCH] #366 and -Djapicmp.skip work --- .../main/java/japicmp/maven/JApiCmpMojo.java | 9 +++--- .../japicmp-test-maven-plugin/pom.xml | 31 +++++++++++++++++++ .../src/test/java/japicmp/test/ITSkip.java | 28 +++++++++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 japicmp-testbase/japicmp-test-maven-plugin/src/test/java/japicmp/test/ITSkip.java diff --git a/japicmp-maven-plugin/src/main/java/japicmp/maven/JApiCmpMojo.java b/japicmp-maven-plugin/src/main/java/japicmp/maven/JApiCmpMojo.java index a1d9a82c7..8f7807447 100644 --- a/japicmp-maven-plugin/src/main/java/japicmp/maven/JApiCmpMojo.java +++ b/japicmp-maven-plugin/src/main/java/japicmp/maven/JApiCmpMojo.java @@ -66,8 +66,10 @@ public class JApiCmpMojo extends AbstractMojo { private List oldClassPathDependencies; @org.apache.maven.plugins.annotations.Parameter(required = false) private List newClassPathDependencies; - @org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skip", required = false) + @org.apache.maven.plugins.annotations.Parameter(defaultValue = "false") private boolean skip; + @org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skip", defaultValue = "false") + private boolean skipExec; @org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skipXmlReport", required = false) private boolean skipXmlReport; @org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skipHtmlReport", required = false) @@ -104,7 +106,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { MavenParameters mavenParameters = new MavenParameters(this.artifactRepositories, this.mavenProject, this.mojoExecution, this.versionRangeWithProjectVersion, this.repoSystem, this.repoSession, this.remoteRepos); - PluginParameters pluginParameters = new PluginParameters(this.skip, this.newVersion, this.oldVersion, this.parameter, this.dependencies, Optional.of( + PluginParameters pluginParameters = new PluginParameters(this.skipExec || this.skip, this.newVersion, this.oldVersion, this.parameter, this.dependencies, Optional.of( this.projectBuildDir), Optional.absent(), true, this.oldVersions, this.newVersions, this.oldClassPathDependencies, this.newClassPathDependencies); executeWithParameters(pluginParameters, mavenParameters); @@ -185,8 +187,6 @@ private void setUpOverrideCompatibilityChanges(JarArchiveComparatorOptions compa } } - - private boolean skipModule(PluginParameters pluginParameters, MavenParameters mavenParameters) { SkipModuleStrategy skipModuleStrategy = new SkipModuleStrategy(pluginParameters, mavenParameters, getLog()); return skipModuleStrategy.skip(); @@ -197,7 +197,6 @@ private enum ConfigurationVersion { } private static DefaultArtifact createDefaultArtifact(MavenProject mavenProject, String version) { - org.apache.maven.artifact.Artifact artifact = mavenProject.getArtifact(); return createDefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), version); } diff --git a/japicmp-testbase/japicmp-test-maven-plugin/pom.xml b/japicmp-testbase/japicmp-test-maven-plugin/pom.xml index ecdf69305..b62f8d8ac 100644 --- a/japicmp-testbase/japicmp-test-maven-plugin/pom.xml +++ b/japicmp-testbase/japicmp-test-maven-plugin/pom.xml @@ -650,6 +650,37 @@ + + skip + pre-integration-test + + cmp + + + true + + + com.github.siom79.japicmp + japicmp-test-v1 + ${project.version} + + + + + com.github.siom79.japicmp + japicmp-test-v2 + ${project.version} + + + + + org.apache.commons + commons-math3 + 3.4 + + + +