Skip to content

Commit 29af44d

Browse files
committed
fj-doc-maven-plugin verify documentation
1 parent 244b22b commit 29af44d

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/FreeMarkerTemplateSyntaxVerifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public VerifyTemplateOutput verify(File baseFolder, Configuration cfg, Propertie
119119
} );
120120
}
121121

122-
public void generateReport( VerifyTemplateOutput output, Properties params ) throws IOException {
122+
public void generateReport( VerifyTemplateOutput output, Properties params ) {
123123
boolean generateReport = BooleanUtils.isTrue( params.getProperty( PARAM_GENERATE_REPORT ) );
124124
if ( generateReport ) {
125125
String reportOutputFolder = params.getProperty( PARAM_REPORT_OUTPUT_FOLDER );
@@ -136,6 +136,7 @@ public void generateReport( VerifyTemplateOutput output, Properties params ) thr
136136
try (ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
137137
FreeMarkerDocProcess.getInstance().fullProcess( chainId, DocProcessContext.newContext( "output", output ), type, buffer );
138138
FileIO.writeBytes( buffer.toByteArray(), reportFile );
139+
log.info( "report generated : {}", reportFile.getCanonicalPath() );
139140
} catch ( Exception e ) {
140141
throw new ConfigRuntimeException(
141142
String.format( "Fail to generate report in folder %s, error : %s", reportOutputFolder, e.getMessage() ), e );

fj-doc-maven-plugin/README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,46 @@ mvn org.fugerit.java:fj-doc-maven-plugin:add \
7070

7171
## Goal : verify
7272

73-
add Venus Doc Configuration to an existing project
73+
verify the templates in a FreeMarker configuration (folder), note: it can be used on any Apache FreeMarker configuration, not only Fugerit Venus Doc.
7474

7575
*Quickstart* :
7676

77+
### Verify existing FreeMarker configuration
78+
7779
```shell
7880
mvn org.fugerit.java:fj-doc-maven-plugin:verify -DtemplateBasePath=./src/test/resources/fj_doc_test/template-fail
7981
```
8082

81-
verify the templates in a FreeMarker configuration (folder), note: it can be used on any Apache FreeMarker configuration, not only Fugerit Venus Doc.
83+
### Verify FreeMarker configuration at maven build time
84+
85+
```xml
86+
<plugin>
87+
<groupId>org.fugerit.java</groupId>
88+
<artifactId>fj-doc-maven-plugin</artifactId>
89+
<version>${fj-doc-version}</version>
90+
<executions>
91+
<execution>
92+
<id>daogen</id>
93+
<phase>compile</phase>
94+
<goals>
95+
<goal>verify</goal>
96+
</goals>
97+
</execution>
98+
</executions>
99+
<configuration>
100+
<templateBasePath>${project.basedir}/src/main/resources/fugerit-blank/template</templateBasePath>
101+
<generateReport>true</generateReport>
102+
<failOnErrors>true</failOnErrors>
103+
<reportOutputFolder>${project.build.directory}/freemarker-syntax-verify-report</reportOutputFolder>
104+
</configuration>
105+
</plugin>
106+
```
82107

83108
| parameter | required | default | description |
84109
|---------------------|----------|---------------|--------------------------------------------------------------------------------------------------------------------|
85110
| templateBasePath | true | | Path to base folder containing FreeMarker templates |
86111
| freemarkerVersion | false | latest stable | FreeMarker configuration ( i.e. 2.3.33) |
87112
| templateFilePattern | false | | Filter on templates to be checked, regex on filename, i.e. ".{0,}[.]ftl" |
88113
| failOnErrors | true | true | If set to true the build will fail when template syntax errors will be found, otherwise errors will be only logged |
89-
114+
| generateReport | false | false | If set to true a report will be generated (and property 'reportOutputFolder' will be olso required). |
115+
| reportOutputFolder | false | | Output folder for the generated report. |

0 commit comments

Comments
 (0)