Skip to content

Commit 0a478e3

Browse files
authored
Merge pull request #33 from patrickbray/add-skip-option
Adding skip option to plugin based on kutsal's existing PR.
2 parents 0869752 + 3fb038f commit 0a478e3

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/main/java/io/github/swagger2markup/Swagger2MarkupMojo.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,17 @@ public class Swagger2MarkupMojo extends AbstractMojo {
4646
@Parameter
4747
protected Map<String, String> config = new HashMap<>();
4848

49+
@Parameter(property = "skip")
50+
protected boolean skip;
51+
4952
@Override
5053
public void execute() throws MojoExecutionException, MojoFailureException {
54+
55+
if (skip) {
56+
getLog().info("convertSwagger2markup is skipped.");
57+
return;
58+
}
59+
5160
if (getLog().isDebugEnabled()) {
5261
getLog().debug("convertSwagger2markup goal started");
5362
getLog().debug("swaggerInput: " + swaggerInput);

src/test/java/io/github/swagger2markup/Swagger2MarkupMojoTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ public void clearGeneratedData() throws Exception {
3232
FileUtils.deleteQuietly(outputDir);
3333
}
3434

35+
@Test
36+
public void shouldSkipExecution() throws Exception {
37+
//given
38+
Swagger2MarkupMojo mojo = new Swagger2MarkupMojo();
39+
mojo.outputFile = new File(OUTPUT_DIR, SWAGGER_OUTPUT_FILE).getAbsoluteFile();
40+
mojo.skip = true;
41+
42+
//when
43+
mojo.execute();
44+
45+
//then
46+
assertThat(mojo.outputFile).doesNotExist();
47+
}
48+
3549
@Test
3650
public void shouldConvertIntoFile() throws Exception {
3751
//given

0 commit comments

Comments
 (0)