Skip to content

Commit 5d2eb5e

Browse files
authored
Fix Could not find goal 'verify' #180 (#181)
* Updated documentation #180 * Fix Could not find goal 'verify' #180 * log level warn if feature skipped #180
1 parent 0354f8e commit 5d2eb5e

File tree

4 files changed

+49
-31
lines changed

4 files changed

+49
-31
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- fj-doc-maven-plugin is no on plugin management of fj-doc parent
1414
- [fj-doc-sample] fj-doc-maven-plugin:verify configuration
1515

16+
### Fixed
17+
18+
- [fj-doc-maven-plugin] Could not find goal 'verify' <https://github.com/fugerit-org/fj-doc/issues/180>
19+
1620
## [8.7.4] - 2024-08-28
1721

1822
### Fixed

fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/BasicVenusFacade.java

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -103,44 +103,50 @@ protected static void addExtensionList( File pomFile, VenusContext context ) thr
103103
}
104104
}
105105
log.info( "end dependencies size : {}", model.getDependencies().size() );
106-
// addVerifyPlugin?
107-
log.info( "addVerifyPlugin : {}", context.isAddVerifyPlugin() );
108106
addPlugin( context, model );
109107
try (OutputStream pomStream = new FileOutputStream( pomFile ) ) {
110108
modelIO.writeModelToStream( model, pomStream );
111109
}
112110
}
113111

114112
private static void addPlugin( VenusContext context, Model model ) throws IOException {
113+
// addVerifyPlugin?
115114
if ( context.isAddVerifyPlugin() ) {
116-
Build build = model.getBuild();
117-
if ( build == null ) {
118-
build = new Build();
119-
model.setBuild( build );
120-
}
121-
List<Plugin> plugins = model.getBuild().getPlugins();
122-
Plugin plugin = new Plugin();
123-
plugin.setGroupId( GROUP_ID );
124-
plugin.setArtifactId( "fj-doc-maven-plugin" );
125-
plugin.setVersion( "${"+KEY_VERSION+"}" );
126-
PluginExecution execution = new PluginExecution();
127-
execution.setId( "freemarker-verify" );
128-
execution.setPhase( "compile" );
129-
execution.addGoal( "verify" );
130-
plugin.getExecutions().add( execution );
131-
String xml = "<configuration>\n" +
132-
" <templateBasePath>${project.basedir}/src/main/resources/"+context.getArtificatIdForFolder()+"/template</templateBasePath>\n" +
133-
" <generateReport>true</generateReport>\n" +
134-
" <failOnErrors>true</failOnErrors>\n" +
135-
" <reportOutputFolder>${project.build.directory}/freemarker-syntax-verify-report</reportOutputFolder>\n" +
136-
" </configuration>";
137-
HelperIOException.apply( () -> {
138-
try ( StringReader sr = new StringReader( xml ) ) {
139-
Xpp3Dom dom = Xpp3DomBuilder.build( sr );
140-
plugin.setConfiguration( dom );
115+
if ( context.isVerifyPluginNotAvailable() ) {
116+
log.warn( "addVerifyPlugin skipped, version {} has been selected, minimum required version is : {}", context.getVersion(), VenusContext.VERSION_NA_VERIFY_PLUGIN );
117+
} else {
118+
log.info( "addVerifyPlugin true, version {} has been selected, minimum required version is : {}", context.getVersion(), VenusContext.VERSION_NA_VERIFY_PLUGIN );
119+
Build build = model.getBuild();
120+
if ( build == null ) {
121+
build = new Build();
122+
model.setBuild( build );
141123
}
142-
});
143-
plugins.add( plugin );
124+
List<Plugin> plugins = model.getBuild().getPlugins();
125+
Plugin plugin = new Plugin();
126+
plugin.setGroupId( GROUP_ID );
127+
plugin.setArtifactId( "fj-doc-maven-plugin" );
128+
plugin.setVersion( "${"+KEY_VERSION+"}" );
129+
PluginExecution execution = new PluginExecution();
130+
execution.setId( "freemarker-verify" );
131+
execution.setPhase( "compile" );
132+
execution.addGoal( "verify" );
133+
plugin.getExecutions().add( execution );
134+
String xml = "<configuration>\n" +
135+
" <templateBasePath>${project.basedir}/src/main/resources/"+context.getArtificatIdForFolder()+"/template</templateBasePath>\n" +
136+
" <generateReport>true</generateReport>\n" +
137+
" <failOnErrors>true</failOnErrors>\n" +
138+
" <reportOutputFolder>${project.build.directory}/freemarker-syntax-verify-report</reportOutputFolder>\n" +
139+
" </configuration>";
140+
HelperIOException.apply( () -> {
141+
try ( StringReader sr = new StringReader( xml ) ) {
142+
Xpp3Dom dom = Xpp3DomBuilder.build( sr );
143+
plugin.setConfiguration( dom );
144+
}
145+
});
146+
plugins.add( plugin );
147+
}
148+
} else {
149+
log.info( "addVerifyPlugin : false" );
144150
}
145151
}
146152

fj-doc-maven-plugin/src/main/java/org/fugerit/java/doc/project/facade/VenusContext.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
@ToString
1818
public class VenusContext {
1919

20+
public static final String VERSION_NA_VERIFY_PLUGIN = "8.7.2";
21+
22+
public static final String VERSION_NA_FULL_PROCESS = "8.6.2";
23+
2024
@Getter
2125
private File projectDir;
2226

@@ -97,8 +101,12 @@ public String getDocConfigClass() {
97101
return "DocHelper";
98102
}
99103

104+
public boolean isVerifyPluginNotAvailable() {
105+
return VersionCheck.isMajorThan( VERSION_NA_VERIFY_PLUGIN, this.getVersion() );
106+
}
107+
100108
public boolean isPreVersion862() {
101-
return VersionCheck.isMajorThan( "8.6.2", this.getVersion() );
109+
return VersionCheck.isMajorThan( VERSION_NA_FULL_PROCESS, this.getVersion() );
102110
}
103111

104112
}

fj-doc-maven-plugin/src/test/java/test/org/fugerit/java/doc/project/facade/TestAddVenusFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void testMojoAdd() throws IOException, MojoExecutionException, MojoFailur
6969
MojoAdd mojoAdd = new MojoAdd() {
7070
@Override
7171
public void execute() throws MojoExecutionException, MojoFailureException {
72-
this.version = getVersion();
72+
this.version = VenusContext.VERSION_NA_VERIFY_PLUGIN;
7373
this.extensions = "fj-doc-base,fj-doc-base-json,fj-doc-base-yaml,fj-doc-freemarker,fj-doc-mod-fop,fj-doc-mod-poi,fj-doc-mod-opencsv";
7474
this.projectFolder = projectDir.getAbsolutePath();
7575
this.addDocFacade = true;

0 commit comments

Comments
 (0)