Skip to content

Commit e08688f

Browse files
committed
#366 <skip> and -Djapicmp.skip work
1 parent a644096 commit e08688f

File tree

3 files changed

+63
-5
lines changed

3 files changed

+63
-5
lines changed

japicmp-maven-plugin/src/main/java/japicmp/maven/JApiCmpMojo.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ public class JApiCmpMojo extends AbstractMojo {
6666
private List<Dependency> oldClassPathDependencies;
6767
@org.apache.maven.plugins.annotations.Parameter(required = false)
6868
private List<Dependency> newClassPathDependencies;
69-
@org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skip", required = false)
69+
@org.apache.maven.plugins.annotations.Parameter(defaultValue = "false")
7070
private boolean skip;
71+
@org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skip", defaultValue = "false")
72+
private boolean skipExec;
7173
@org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skipXmlReport", required = false)
7274
private boolean skipXmlReport;
7375
@org.apache.maven.plugins.annotations.Parameter(property = "japicmp.skipHtmlReport", required = false)
@@ -104,7 +106,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
104106
MavenParameters mavenParameters = new MavenParameters(this.artifactRepositories,
105107
this.mavenProject, this.mojoExecution, this.versionRangeWithProjectVersion, this.repoSystem, this.repoSession,
106108
this.remoteRepos);
107-
PluginParameters pluginParameters = new PluginParameters(this.skip, this.newVersion, this.oldVersion, this.parameter, this.dependencies, Optional.of(
109+
PluginParameters pluginParameters = new PluginParameters(this.skipExec || this.skip, this.newVersion, this.oldVersion, this.parameter, this.dependencies, Optional.of(
108110
this.projectBuildDir), Optional.<String>absent(), true, this.oldVersions, this.newVersions, this.oldClassPathDependencies,
109111
this.newClassPathDependencies);
110112
executeWithParameters(pluginParameters, mavenParameters);
@@ -185,8 +187,6 @@ private void setUpOverrideCompatibilityChanges(JarArchiveComparatorOptions compa
185187
}
186188
}
187189

188-
189-
190190
private boolean skipModule(PluginParameters pluginParameters, MavenParameters mavenParameters) {
191191
SkipModuleStrategy skipModuleStrategy = new SkipModuleStrategy(pluginParameters, mavenParameters, getLog());
192192
return skipModuleStrategy.skip();
@@ -197,7 +197,6 @@ private enum ConfigurationVersion {
197197
}
198198

199199
private static DefaultArtifact createDefaultArtifact(MavenProject mavenProject, String version) {
200-
201200
org.apache.maven.artifact.Artifact artifact = mavenProject.getArtifact();
202201
return createDefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), version);
203202
}

japicmp-testbase/japicmp-test-maven-plugin/pom.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,37 @@
650650
</dependencies>
651651
</configuration>
652652
</execution>
653+
<execution>
654+
<id>skip</id>
655+
<phase>pre-integration-test</phase>
656+
<goals>
657+
<goal>cmp</goal>
658+
</goals>
659+
<configuration>
660+
<skip>true</skip>
661+
<oldVersion>
662+
<dependency>
663+
<groupId>com.github.siom79.japicmp</groupId>
664+
<artifactId>japicmp-test-v1</artifactId>
665+
<version>${project.version}</version>
666+
</dependency>
667+
</oldVersion>
668+
<newVersion>
669+
<dependency>
670+
<groupId>com.github.siom79.japicmp</groupId>
671+
<artifactId>japicmp-test-v2</artifactId>
672+
<version>${project.version}</version>
673+
</dependency>
674+
</newVersion>
675+
<dependencies>
676+
<dependency>
677+
<groupId>org.apache.commons</groupId>
678+
<artifactId>commons-math3</artifactId>
679+
<version>3.4</version>
680+
</dependency>
681+
</dependencies>
682+
</configuration>
683+
</execution>
653684
</executions>
654685
</plugin>
655686
<!-- run site plugin to build reports during 'pre-integration-test' phase
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package japicmp.test;
2+
3+
import org.junit.Test;
4+
5+
import java.io.IOException;
6+
import java.nio.file.Files;
7+
import java.nio.file.Paths;
8+
9+
import static org.hamcrest.core.Is.is;
10+
import static org.junit.Assert.assertThat;
11+
12+
public class ITSkip {
13+
14+
@Test
15+
public void testXmlReportNotGenerated() throws IOException {
16+
assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "japicmp", "skip.html")), is(false));
17+
}
18+
19+
@Test
20+
public void testHtmlReportNotGenerated() throws IOException {
21+
assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "japicmp", "skip.xml")), is(false));
22+
}
23+
24+
@Test
25+
public void testDiffReportGenerated() throws IOException {
26+
assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "japicmp", "skip.diff")), is(false));
27+
}
28+
}

0 commit comments

Comments
 (0)