@@ -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
0 commit comments