Skip to content

Commit ce99f3d

Browse files
committed
chore(init): project initialization
mvn org.fugerit.java:fj-doc-maven-plugin:init \ -DgroupId=org.fugerit.java.demo \ -DartifactId=bare-minimum-github-repo-java-maven
0 parents  commit ce99f3d

File tree

8 files changed

+336
-0
lines changed

8 files changed

+336
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#Maven
2+
target/
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
release.properties
7+
.flattened-pom.xml
8+
9+
# Eclipse
10+
.project
11+
.classpath
12+
.settings/
13+
bin/
14+
15+
# IntelliJ
16+
.idea
17+
*.ipr
18+
*.iml
19+
*.iws
20+
21+
# NetBeans
22+
nb-configuration.xml
23+
24+
# Visual Studio Code
25+
.vscode
26+
.factorypath
27+
28+
# OSX
29+
.DS_Store
30+
31+
# Vim
32+
*.swp
33+
*.swo
34+
35+
# patch
36+
*.orig
37+
*.rej
38+
39+
# Local environment
40+
.env
41+
42+
# Plugin directory
43+
/.quarkus/cli/plugins/
44+
# TLS Certificates
45+
.certs/

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# bare-minimum-github-repo-java-maven
2+
3+
This is a sample project configured using [fj-doc-maven-plugin init plugin](https://venusdocs.fugerit.org/guide/#maven-plugin-goal-init).
4+

pom.xml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.fugerit.java.demo</groupId>
6+
<artifactId>bare-minimum-github-repo-java-maven</artifactId>
7+
<version>1.0.0-SNAPSHOT</version>
8+
<properties>
9+
<maven.compiler.release>21</maven.compiler.release>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<fj-doc-version>8.16.9</fj-doc-version>
12+
</properties>
13+
<dependencyManagement>
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.fugerit.java</groupId>
17+
<artifactId>fj-doc</artifactId>
18+
<version>${fj-doc-version}</version>
19+
<type>pom</type>
20+
<scope>import</scope>
21+
</dependency>
22+
</dependencies>
23+
</dependencyManagement>
24+
<dependencies>
25+
<dependency>
26+
<groupId>org.fugerit.java</groupId>
27+
<artifactId>fj-doc-base</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.fugerit.java</groupId>
31+
<artifactId>fj-doc-freemarker</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.junit.jupiter</groupId>
35+
<artifactId>junit-jupiter</artifactId>
36+
<scope>test</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.projectlombok</groupId>
40+
<artifactId>lombok</artifactId>
41+
<scope>provided</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.slf4j</groupId>
45+
<artifactId>slf4j-simple</artifactId>
46+
<scope>test</scope>
47+
</dependency>
48+
</dependencies>
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.fugerit.java</groupId>
53+
<artifactId>fj-doc-maven-plugin</artifactId>
54+
<version>${fj-doc-version}</version>
55+
<executions>
56+
<execution>
57+
<id>freemarker-verify</id>
58+
<phase>compile</phase>
59+
<goals>
60+
<goal>verify</goal>
61+
</goals>
62+
<configuration>
63+
<templateBasePath>${project.basedir}/src/main/resources/bare-minimum-github-repo-java-maven/template</templateBasePath>
64+
<generateReport>true</generateReport>
65+
<failOnErrors>true</failOnErrors>
66+
<reportOutputFolder>${project.build.directory}/freemarker-syntax-verify-report</reportOutputFolder>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
</project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.fugerit.java.demo.bareminimumgithubrepojavamaven;
2+
3+
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfig;
4+
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
5+
6+
/**
7+
* DocHelper, version : auto generated on 2025-10-11 21:27:26.341
8+
*/
9+
public class DocHelper {
10+
11+
/*
12+
* FreemarkerDocProcessConfig is thread-safe and should be initialized once for each config file.
13+
*
14+
* Consider using a @ApplicationScoped or Singleton approach.
15+
*/
16+
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://bare-minimum-github-repo-java-maven/fm-doc-process-config.xml" );
17+
18+
/**
19+
* Accessor for FreemarkerDocProcessConfig configuration.
20+
*
21+
* @return the FreemarkerDocProcessConfig instance associated with this helper.
22+
*/
23+
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
24+
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// generated from template 'People.ftl' on 2025-10-11T21:27:26.348+02:00
2+
package org.fugerit.java.demo.bareminimumgithubrepojavamaven;
3+
4+
import lombok.Getter;
5+
import lombok.AllArgsConstructor;
6+
7+
/*
8+
* Class used to wrap data to be rendered in the document template
9+
*/
10+
@Getter
11+
@AllArgsConstructor
12+
public class People {
13+
14+
private String name;
15+
16+
private String surname;
17+
18+
private String title;
19+
20+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- generated from template 'fm-doc-process-config-template.ftl' on 2025-10-11T21:27:26.325+02:00 -->
3+
<freemarker-doc-process-config
4+
xmlns="https://freemarkerdocprocess.fugerit.org"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="https://freemarkerdocprocess.fugerit.org https://www.fugerit.org/data/java/doc/xsd/freemarker-doc-process-1-0.xsd" >
7+
8+
<!--
9+
Documentation :
10+
https://venusdocs.fugerit.org/guide/
11+
12+
Configuration reference :
13+
https://venusdocs.fugerit.org/fj-doc-freemarker/src/main/docs/fdp_xsd_config_ref.html
14+
-->
15+
16+
<docHandlerConfig registerById="true">
17+
18+
<!-- Type handler for markdown format -->
19+
<docHandler id="md-ext" info="md" type="org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandler" />
20+
<!-- Type handler for xml format, generates the source xml:doc -->
21+
<docHandler id="xml-doc" info="xml" type="org.fugerit.java.doc.base.typehandler.core.DocTypeHandlerCoreXMLUTF8" />
22+
<!-- Type handler for html using freemarker -->
23+
<docHandler id="html-fm" info="html" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerEscapeUTF8" />
24+
<!-- Type handler for html using freemarker (fragment version, only generates body content no html or head part -->
25+
<docHandler id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerEscapeUTF8" />
26+
<!-- type handler for asciidoc using freemarker -->
27+
<docHandler id="asciidoc-fm" info="adoc" type="org.fugerit.java.doc.freemarker.asciidoc.FreeMarkerAsciidocTypeHandlerUTF8" />
28+
</docHandlerConfig>
29+
30+
<docChain id="shared">
31+
<chainStep stepType="config">
32+
<config
33+
id="fj_doc_config_fm_bareminimumgithubrepojavamaven"
34+
class="org.fugerit.java.demo.bareminimumgithubrepojavamaven.DocHelper"
35+
exception-handler="RETHROW_HANDLER"
36+
fallback-on-null-loop-variable="false"
37+
log-exception="false"
38+
mode="class"
39+
path="/bare-minimum-github-repo-java-maven/template/"
40+
version="2.3.32"
41+
wrap-unchecked-exceptions="true"
42+
load-bundled-functions="true"
43+
/>
44+
</chainStep>
45+
</docChain>
46+
47+
<!-- example document chain xml -->
48+
<docChain id="document" parent="shared">
49+
<chainStep stepType="complex" map-all="true" template-path="${chainId}.ftl"/>
50+
</docChain>
51+
52+
53+
54+
55+
</freemarker-doc-process-config>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<doc
3+
xmlns="http://javacoredoc.fugerit.org"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-1.xsd" >
6+
7+
<#--
8+
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) FreeMarker Template XML (ftl[x]).
9+
For consideration of Venus Fugerit Doc and Apache FreeMarker integration see :
10+
https://venusdocs.fugerit.org/guide/#doc-freemarker-entry-point
11+
The result will be a :
12+
-->
13+
<!--
14+
This is a Venus Fugerit Doc (https://github.com/fugerit-org/fj-doc) XML Source Document.
15+
For documentation on how to write a valid Venus Doc XML Meta Model refer to :
16+
https://venusdocs.fugerit.org/guide/#doc-format-entry-point
17+
-->
18+
19+
<#assign defaultTitle="My sample title XML">
20+
21+
<metadata>
22+
<!-- Margin for document : left;right;top;bottom -->
23+
<info name="margins">10;10;10;30</info>
24+
<!-- documenta meta information -->
25+
<info name="doc-title">${docTitle!defaultTitle}</info>
26+
<info name="doc-subject">fj doc venus sample source FreeMarker Template XML - ftlx</info>
27+
<info name="doc-author">fugerit79</info>
28+
<info name="doc-language">en</info>
29+
<!-- property specific for xls/xlsx -->
30+
<info name="excel-table-id">data-table=print</info>
31+
<!-- property specific for csv -->
32+
<info name="csv-table-id">data-table</info>
33+
<footer-ext>
34+
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
35+
</footer-ext>
36+
</metadata>
37+
<body>
38+
<para>${docTitle!defaultTitle}</para>
39+
<table columns="3" colwidths="30;30;40" width="100" id="data-table" padding="2">
40+
<row header="true">
41+
<cell align="center"><para>Name</para></cell>
42+
<cell align="center"><para>Surname</para></cell>
43+
<cell align="center"><para>Title</para></cell>
44+
</row>
45+
<#if listPeople??>
46+
<#list listPeople as current>
47+
<row>
48+
<cell><para>${current.name}</para></cell>
49+
<cell><para>${current.surname}</para></cell>
50+
<cell><para>${current.title}</para></cell>
51+
</row>
52+
</#list>
53+
</#if>
54+
</table>
55+
</body>
56+
57+
</doc>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// generated from template 'DocHelperTest.ftl' on 2025-10-11T21:27:26.344+02:00
2+
package test.org.fugerit.java.demo.bareminimumgithubrepojavamaven;
3+
4+
import org.fugerit.java.demo.bareminimumgithubrepojavamaven.DocHelper;
5+
import org.fugerit.java.demo.bareminimumgithubrepojavamaven.People;
6+
7+
import org.fugerit.java.doc.base.config.DocConfig;
8+
import org.fugerit.java.doc.base.process.DocProcessContext;
9+
10+
import org.junit.jupiter.api.Assertions;
11+
import org.junit.jupiter.api.Test;
12+
13+
import java.io.ByteArrayOutputStream;
14+
import java.nio.charset.StandardCharsets;
15+
import java.util.Arrays;
16+
import java.util.List;
17+
import lombok.extern.slf4j.Slf4j;
18+
import lombok.Getter;
19+
import lombok.AllArgsConstructor;
20+
21+
/**
22+
* This is a basic example of Fugerit Venus Doc usage,
23+
* running this junit will :
24+
* - creates data to be used in document model
25+
* - renders the 'document.ftl' template
26+
* - print the result in markdown format
27+
*
28+
* For further documentation :
29+
* https://github.com/fugerit-org/fj-doc
30+
*
31+
* NOTE: This is a 'Hello World' style example, adapt it to your scenario, especially :
32+
* - change the doc handler and the output mode (here a ByteArrayOutputStream buffer is used)
33+
*/
34+
@Slf4j
35+
class DocHelperTest {
36+
37+
@Test
38+
void testDocProcess() throws Exception {
39+
try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
40+
// creates the doc helper
41+
DocHelper docHelper = new DocHelper();
42+
// create custom data for the fremarker template 'document.ftl'
43+
List<People> listPeople = Arrays.asList( new People( "Luthien", "Tinuviel", "Queen" ), new People( "Thorin", "Oakshield", "King" ) );
44+
45+
46+
String chainId = "document";
47+
// handler id
48+
String handlerId = DocConfig.TYPE_MD;
49+
// output generation
50+
docHelper.getDocProcessConfig().fullProcess( chainId, DocProcessContext.newContext( "listPeople", listPeople ), handlerId, baos );
51+
// print the output
52+
log.info( "{} output : \n{}", handlerId, new String( baos.toByteArray(), StandardCharsets.UTF_8 ) );
53+
Assertions.assertNotEquals( 0, baos.size() );
54+
}
55+
}
56+
57+
}

0 commit comments

Comments
 (0)