Skip to content

Commit bf6a0f1

Browse files
Fix documentation formatting, add menu items for new examples
1 parent 1d90140 commit bf6a0f1

8 files changed

+58
-45
lines changed

src/site/apt/examples/example-exec-for-java-programs.apt.vm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath"
5050

5151
To execute Java programs, the Exec Maven Plugin helps by allowing the <<<\<classpath\>>>> special argument:
5252

53-
-------------------
53+
+-------------------+
5454
<configuration>
5555
<executable>java</executable>
5656
<arguments>
@@ -79,11 +79,11 @@ mvn exec:exec -Dexec.executable="java" [...] -Dexec.args="%classpath"
7979
...
8080
</arguments>
8181
</configuration>
82-
-------------------
82+
+-------------------+
8383

8484
In case of the modules as supported since Java9 the configuration looks like
8585

86-
-------------------
86+
+-------------------+
8787
<configuration>
8888
<executable>java</executable>
8989
<arguments>
@@ -96,4 +96,4 @@ In case of the modules as supported since Java9 the configuration looks like
9696
...
9797
</arguments>
9898
</configuration>
99-
-------------------
99+
+-------------------+

src/site/apt/examples/example-exec-or-java-change-classpath-scope.apt.vm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ Changing the classpath scope when running Java programs
2929
to change the scope of the plugin execution. This can be achieved using the <<<classpathScope>>> configuration element,
3030
e.g. for a <<<test>>> scope:
3131

32-
-------------------
32+
+-------------------+
3333
<configuration>
3434
...
3535
<classpathScope>test</classpathScope>
3636
...
3737
</configuration>
38-
-------------------
38+
+-------------------+
3939

4040
or, on the command line,
4141

src/site/apt/examples/example-exec-using-executabledependency.apt.vm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Using Executable Binary Dependencies Instead of Local Executables
3939

4040
** pom.xml
4141

42-
-------------------
42+
+-------------------+
4343
<project>
4444
...
4545
<build>
@@ -71,4 +71,4 @@ Using Executable Binary Dependencies Instead of Local Executables
7171
</build>
7272
...
7373
</project>
74-
-------------------
74+
+-------------------+

src/site/apt/examples/example-exec-using-plugin-dependencies.apt.vm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Using Plugin Dependencies Instead of Project Dependencies
5454

5555
* Example POM Configuration using Plugin Dependencies
5656

57-
-------------------
57+
+-------------------+
5858
<project>
5959
...
6060
<build>
@@ -104,4 +104,4 @@ Using Plugin Dependencies Instead of Project Dependencies
104104
</build>
105105
...
106106
</project>
107-
-------------------
107+
+-------------------+

src/site/apt/examples/example-exec-using-toolchains.apt.vm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Using Toolchains Instead of Explicit Paths
4040

4141
** pom.xml
4242

43-
-------------------
43+
+-------------------+
4444
<project>
4545
...
4646
<build>
@@ -80,11 +80,11 @@ Using Toolchains Instead of Explicit Paths
8080
</build>
8181
...
8282
</project>
83-
-------------------
83+
+-------------------+
8484

8585
** toolchains.xml
8686

87-
-------------------
87+
+-------------------+
8888
<?xml version="1.0" encoding="UTF8"?>
8989
<toolchains>
9090
<toolchain>
@@ -102,7 +102,7 @@ Using Toolchains Instead of Explicit Paths
102102
</toolchain>
103103
...
104104
</toolchains>
105-
-------------------
105+
+-------------------+
106106

107107
* The "jdk" Toolchain
108108

@@ -111,7 +111,7 @@ Using Toolchains Instead of Explicit Paths
111111

112112
** pom.xml
113113

114-
-------------------
114+
+-------------------+
115115
<project>
116116
...
117117
<build>
@@ -145,11 +145,11 @@ Using Toolchains Instead of Explicit Paths
145145
</build>
146146
...
147147
</project>
148-
-------------------
148+
+-------------------+
149149

150150
** toolchains.xml
151151

152-
-------------------
152+
+-------------------+
153153
<?xml version="1.0" encoding="UTF8"?>
154154
<toolchains>
155155
<toolchain>
@@ -166,7 +166,7 @@ Using Toolchains Instead of Explicit Paths
166166
</toolchain>
167167
...
168168
</toolchains>
169-
-------------------
169+
+-------------------+
170170

171171
* Custom Toolchains
172172

@@ -176,7 +176,7 @@ Using Toolchains Instead of Explicit Paths
176176

177177
** pom.xml
178178

179-
-------------------
179+
+-------------------+
180180
<project>
181181
...
182182
<build>
@@ -217,11 +217,11 @@ Using Toolchains Instead of Explicit Paths
217217
</build>
218218
...
219219
</project>
220-
-------------------
220+
+-------------------+
221221

222222
** toolchains.xml
223223

224-
-------------------
224+
+-------------------+
225225
<?xml version="1.0" encoding="UTF8"?>
226226
<toolchains>
227227
<toolchain>
@@ -235,4 +235,4 @@ Using Toolchains Instead of Explicit Paths
235235
</toolchain>
236236
...
237237
</toolchains>
238-
-------------------
238+
+-------------------+

src/site/apt/examples/example-java-project-properties.apt.vm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
~~ NOTE: For help with the syntax of this file, see:
2424
~~ http://maven.apache.org/doxia/references/apt-format.html
2525

26+
Forward maven properties to exec:java goal
2627

27-
You can ensure the maven properties are available to your main forcing `<projectProperties />` property type.
28+
You can ensure the maven properties are available to your main forcing <<<\<projectProperties /\>>>> property type.
2829

29-
Tip: you can still override potentially conflicting properties if you set them *after*.
30+
Tip: you can still override potentially conflicting properties if you set them <<after>>.
3031

3132
* pom.xml
3233

33-
-------------------
34+
+-------------------+
3435
<project>
3536
...
3637
<build>
@@ -67,5 +68,4 @@ You can ensure the maven properties are available to your main forcing `<project
6768
</build>
6869
...
6970
</project>
70-
-------------------
71-
71+
+-------------------+

src/site/apt/examples/example-java-runnable.vm renamed to src/site/apt/examples/example-java-runnable.apt.vm

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
------
2-
Use Runnable with exec:java goal
2+
Execute a Runnable instead of a main
33
------
44
Romain Manni-Bucau
55
------
6-
2022-11-14
6+
2024-01-27
77
------
88

9-
~~ Copyright 2022 The Codehaus
9+
~~ Copyright 2024 The Codehaus
1010
~~
1111
~~ Licensed under the Apache License, Version 2.0 (the "License");
1212
~~ you may not use this file except in compliance with the License.
@@ -23,12 +23,13 @@
2323
~~ NOTE: For help with the syntax of this file, see:
2424
~~ http://maven.apache.org/doxia/references/apt-format.html
2525

26+
Execute a Runnable instead of a main
2627

27-
You can use since version `3.1.2` a `Runnable` instead of providing a main class to `exec:java`:
28+
You can use since version <<<3.2.0>>> a <<<Runnable>>> instead of providing a main class to <<<exec:java>>>:
2829

2930
* pom.xml
3031

31-
-------------------
32+
+-------------------+
3233
<project>
3334
...
3435
<build>
@@ -54,25 +55,33 @@ You can use since version `3.1.2` a `Runnable` instead of providing a main class
5455
</build>
5556
...
5657
</project>
57-
-------------------
58+
+-------------------+
5859

5960
The Runnable can be a plain class but can also get constructor injections:
6061

61-
* `systemProperties`: `Properties`, session system properties
62-
* `systemPropertiesUpdater`: `BiConsumer&lt;String, String&gt;`, session system properties update callback (pass the key/value to update, null value means removal of the key)
63-
* `userProperties`: `Properties`, session user properties
64-
* `userPropertiesUpdater`: `BiConsumer&lt;String, String&gt;`, session user properties update callback (pass the key/value to update, null value means removal of the key)
65-
* `projectProperties`: `Properties`, project properties
66-
* `projectPropertiesUpdater`: `BiConsumer&lt;String, String&gt;`, project properties update callback (pass the key/value to update, null value means removal of the key)
67-
* `highestVersionResolver`: `Function&lt;String, String&gt;`, passing a `groupId:artifactId` you get the latest resolved version from the project repositories.
62+
* <<<systemProperties>>>: <<<Properties>>>, session system properties
6863

69-
Lastly you can inject a custom maven component naming the Runnable constructor parameter with its type and replacing dots by underscores.
70-
If you need to provide a hint you can suffix previous type name by `__hint_$yourhint` (assuming it stays a valid java name).
71-
This kind of parameter injection must be typed `Object`.
64+
* <<<systemPropertiesUpdate>>>: <<<BiConsumer\<String, String\>>>>, session system properties update callback (pass the key/value to update, null value means removal of the key)
65+
66+
* <<<userProperties>>>: <<<Properties>>>, session user properties
67+
68+
* <<<userPropertiesUpdater>>>: <<<BiConsumer\<String, String\>>>>, session user properties update callback (pass the key/value to update, null value means removal of the key)
69+
70+
* <<<projectProperties>>>: <<<Properties>>>, project properties
71+
72+
* <<<projectPropertiesUpdater>>>: <<<BiConsumer\<String, String\>>>>, project properties update callback (pass the key/value to update, null value means removal of the key)
73+
74+
* <<<highestVersionResolver>>>: <<<Function\<String, String\>>>>, passing a <<<groupId:artifactId>>> you get the latest resolved version from the project repositories.
75+
76+
[]
77+
78+
Lastly you can inject a custom maven component naming the Runnable constructor parameter with its type and replacing dots by underscores.
79+
If you need to provide a hint you can suffix previous type name by <<<__hint_$yourhint>>> (assuming it stays a valid java name).
80+
This kind of parameter injection must be typed `Object`.
7281

7382
Example:
7483

75-
-------------------
84+
+-------------------+
7685
public class HelloRunnable implements Runnable {
7786
private final Function<String, String> versionResolver;
7887
private final Properties properties;
@@ -92,4 +101,4 @@ public class HelloRunnable implements Runnable {
92101
updater.accept("hello.runnable.output", v + ": " + (versionResolver != null));
93102
}
94103
}
95-
-------------------
104+
+-------------------+

src/site/site.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
href="examples/example-exec-using-toolchains.html"/>
2525
<item name="Using executable binary dependencies instead of local executables"
2626
href="examples/example-exec-using-executabledependency.html"/>
27+
<item name="Forward maven system properties to the main"
28+
href="examples/example-java-project-properties.html"/>
29+
<item name="Execute a Runnable instead of a main"
30+
href="examples/example-java-runnable.html"/>
2731
</menu>
2832
</body>
2933
</project>

0 commit comments

Comments
 (0)