Skip to content

Commit d240244

Browse files
authored
Merge pull request #168 from EasyG0ing1/FixPluginSamplePOMFile
Reformatted docs/maven/plugin-configuration-samples.md
2 parents 4281b3a + 5bf0dd9 commit d240244

File tree

1 file changed

+160
-178
lines changed

1 file changed

+160
-178
lines changed

docs/maven/plugin-configuration-samples.md

Lines changed: 160 additions & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,220 @@
11
# Plugin configuration samples for Maven
2-
32
## Minimal config
4-
53
```xml
64
<plugin>
7-
<groupId>io.github.fvarrui</groupId>
8-
<artifactId>javapackager</artifactId>
9-
<version>{latest-plugin-version-here}</version>
10-
<executions>
11-
<execution>
12-
<phase>package</phase>
13-
<goals>
14-
<goal>package</goal>
15-
</goals>
16-
<configuration>
17-
<mainClass>fvarrui.sample.Main</mainClass>
18-
</configuration>
19-
</execution>
20-
</executions>
5+
<groupId>io.github.fvarrui</groupId>
6+
<artifactId>javapackager</artifactId>
7+
<version>{latest-plugin-version-here}</version>
8+
<executions>
9+
<execution>
10+
<phase>package</phase>
11+
<goals>
12+
<goal>package</goal>
13+
</goals>
14+
<configuration>
15+
<mainClass>fvarrui.sample.Main</mainClass>
16+
</configuration>
17+
</execution>
18+
</executions>
2119
</plugin>
2220
```
23-
2421
Also, JavaPackager plugin is able to get some properties from `pom.xml`, so you don't need to specify them twice:
25-
2622
```xml
2723
<project>
28-
<properties>
29-
<exec.mainClass>fvarrui.sample.Main</exec.mainClass>
30-
</properties>
31-
<build>
32-
<plugins>
33-
<plugin>
34-
<groupId>io.github.fvarrui</groupId>
35-
<artifactId>javapackager</artifactId>
36-
<version>{latest-plugin-version-here}</version>
37-
<executions>
38-
<execution>
39-
<phase>package</phase>
40-
<goals>
41-
<goal>package</goal>
42-
</goals>
43-
</execution>
44-
</executions>
45-
</plugin>
46-
</plugins>
47-
</build>
24+
<properties>
25+
<exec.mainClass>fvarrui.sample.Main</exec.mainClass>
26+
</properties>
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>io.github.fvarrui</groupId>
31+
<artifactId>javapackager</artifactId>
32+
<version>{latest-plugin-version-here}</version>
33+
<executions>
34+
<execution>
35+
<phase>package</phase>
36+
<goals>
37+
<goal>package</goal>
38+
</goals>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
</plugins>
43+
</build>
4844
</project>
4945
```
5046
> :warning: This minimal configuration will not bundle a JRE, so final user will need one in order to run the app.
51-
5247
## Bundle with a customized JRE
53-
5448
```xml
5549
<plugin>
56-
<groupId>io.github.fvarrui</groupId>
57-
<artifactId>javapackager</artifactId>
58-
<version>{latest-plugin-version-here}</version>
59-
<executions>
60-
<execution>
61-
<phase>package</phase>
62-
<goals>
63-
<goal>package</goal>
64-
</goals>
65-
<configuration>
66-
<mainClass>fvarrui.sample.Main</mainClass>
67-
<bundleJre>true</bundleJre>
68-
</configuration>
69-
</execution>
70-
</executions>
50+
<groupId>io.github.fvarrui</groupId>
51+
<artifactId>javapackager</artifactId>
52+
<version>{latest-plugin-version-here}</version>
53+
<executions>
54+
<execution>
55+
<phase>package</phase>
56+
<goals>
57+
<goal>package</goal>
58+
</goals>
59+
<configuration>
60+
<mainClass>fvarrui.sample.Main</mainClass>
61+
<bundleJre>true</bundleJre>
62+
</configuration>
63+
</execution>
64+
</executions>
7165
</plugin>
7266
```
73-
7467
> `customizedJre` is `true` by default, so you don't have to specify it.
75-
7668
## Bundle with a full JRE
77-
7869
```xml
7970
<plugin>
80-
<groupId>io.github.fvarrui</groupId>
81-
<artifactId>javapackager</artifactId>
82-
<version>{latest-plugin-version-here}</version>
83-
<executions>
84-
<execution>
85-
<phase>package</phase>
86-
<goals>
87-
<goal>package</goal>
88-
</goals>
89-
<configuration>
90-
<mainClass>fvarrui.sample.Main</mainClass>
91-
<bundleJre>true</bundleJre>
92-
<customizedJre>false</customizedJre>
93-
</configuration>
94-
</execution>
95-
</executions>
71+
<groupId>io.github.fvarrui</groupId>
72+
<artifactId>javapackager</artifactId>
73+
<version>{latest-plugin-version-here}</version>
74+
<executions>
75+
<execution>
76+
<phase>package</phase>
77+
<goals>
78+
<goal>package</goal>
79+
</goals>
80+
<configuration>
81+
<mainClass>fvarrui.sample.Main</mainClass>
82+
<bundleJre>true</bundleJre>
83+
<customizedJre>false</customizedJre>
84+
</configuration>
85+
</execution>
86+
</executions>
9687
</plugin>
9788
```
98-
9989
## Bundle with an existing JRE
100-
10190
```xml
10291
<plugin>
103-
<groupId>io.github.fvarrui</groupId>
104-
<artifactId>javapackager</artifactId>
105-
<version>{latest-plugin-version-here}</version>
106-
<executions>
107-
<execution>
108-
<phase>package</phase>
109-
<goals>
110-
<goal>package</goal>
111-
</goals>
112-
<configuration>
113-
<mainClass>fvarrui.sample.Main</mainClass>
114-
<bundleJre>true</bundleJre>
115-
<jrePath>C:\Program Files\Java\jre1.8.0_231</jrePath>
116-
</configuration>
117-
</execution>
118-
</executions>
92+
<groupId>io.github.fvarrui</groupId>
93+
<artifactId>javapackager</artifactId>
94+
<version>{latest-plugin-version-here}</version>
95+
<executions>
96+
<execution>
97+
<phase>package</phase>
98+
<goals>
99+
<goal>package</goal>
100+
</goals>
101+
<configuration>
102+
<mainClass>fvarrui.sample.Main</mainClass>
103+
<bundleJre>true</bundleJre>
104+
<jrePath>C:\Program Files\Java\jre1.8.0_311</jrePath>
105+
</configuration>
106+
</execution>
107+
</executions>
119108
</plugin>
120109
```
121-
122110
## Bundle your own fat JAR
123-
124111
```xml
125112
<plugin>
126-
<groupId>io.github.fvarrui</groupId>
127-
<artifactId>javapackager</artifactId>
128-
<version>{latest-plugin-version-here}</version>
129-
<executions>
130-
<execution>
131-
<phase>package</phase>
132-
<goals>
133-
<goal>package</goal>
134-
</goals>
135-
<configuration>
136-
<mainClass>fvarrui.sample.Main</mainClass>
137-
<bundleJre>true</bundleJre>
138-
<runnableJar>path/to/your/own/fat.jar</runnableJar>
139-
<copyDependencies>false</copyDependencies>
140-
</configuration>
141-
</execution>
142-
</executions>
113+
<groupId>io.github.fvarrui</groupId>
114+
<artifactId>javapackager</artifactId>
115+
<version>{latest-plugin-version-here}</version>
116+
<executions>
117+
<execution>
118+
<phase>package</phase>
119+
<goals>
120+
<goal>package</goal>
121+
</goals>
122+
<configuration>
123+
<mainClass>fvarrui.sample.Main</mainClass>
124+
<bundleJre>true</bundleJre>
125+
<runnableJar>path/to/your/own/fat.jar</runnableJar>
126+
<copyDependencies>false</copyDependencies>
127+
</configuration>
128+
</execution>
129+
</executions>
143130
</plugin>
144131
```
145-
146132
## Multiple executions
147-
148133
```xml
149134
<plugin>
150-
<groupId>io.github.fvarrui</groupId>
151-
<artifactId>javapackager</artifactId>
152-
<version>{latest-plugin-version-here}</version>
135+
<groupId>io.github.fvarrui</groupId>
136+
<artifactId>javapackager</artifactId>
137+
<version>{latest-plugin-version-here}</version>
153138
<configuration>
154-
<mainClass>fvarrui.sample.Main</mainClass>
139+
<mainClass>fvarrui.sample.Main</mainClass>
155140
</configuration>
156-
<executions>
157-
<execution>
158-
<id>bundle-with-jre</id>
159-
<phase>package</phase>
160-
<goals>
161-
<goal>package</goal>
162-
</goals>
163-
<configuration>
164-
<name>Sample</name>
165-
<bundleJre>true</bundleJre>
166-
</configuration>
167-
</execution>
168-
<execution>
169-
<id>bundle-without-jre</id>
170-
<phase>package</phase>
171-
<goals>
172-
<goal>package</goal>
173-
</goals>
174-
<configuration>
175-
<name>Sample-nojre</name>
176-
<bundleJre>false</bundleJre>
177-
</configuration>
178-
</execution>
179-
</executions>
141+
<executions>
142+
<execution>
143+
<id>bundle-with-jre</id>
144+
<phase>package</phase>
145+
<goals>
146+
<goal>package</goal>
147+
</goals>
148+
<configuration>
149+
<name>Sample</name>
150+
<bundleJre>true</bundleJre>
151+
</configuration>
152+
</execution>
153+
<execution>
154+
<id>bundle-without-jre</id>
155+
<phase>package</phase>
156+
<goals>
157+
<goal>package</goal>
158+
</goals>
159+
<configuration>
160+
<name>Sample-nojre</name>
161+
<bundleJre>false</bundleJre>
162+
</configuration>
163+
</execution>
164+
</executions>
180165
</plugin>
181166
```
182-
183167
E.g. on Windows, last configuration will generate next artifacts:
184168
* `Sample_x.y.z.exe` with a bundled JRE.
185169
* `Sample-nojre_x.y.z.exe` without JRE.
186-
187170
## Bundling for multiple platforms
188-
189171
```xml
190172
<plugin>
191-
<groupId>io.github.fvarrui</groupId>
192-
<artifactId>javapackager</artifactId>
193-
<version>{latest-plugin-version-here}</version>
173+
<groupId>io.github.fvarrui</groupId>
174+
<artifactId>javapackager</artifactId>
175+
<version>{latest-plugin-version-here}</version>
194176
<configuration>
195177
<bundleJre>true</bundleJre>
196-
<mainClass>fvarrui.sample.Main</mainClass>
178+
<mainClass>fvarrui.sample.Main</mainClass>
197179
<generateInstaller>false</generateInstaller>
198-
</configuration>
199-
<executions>
200-
<execution>
201-
<id>bundling-for-windows</id>
202-
<phase>package</phase>
203-
<goals>
204-
<goal>package</goal>
205-
</goals>
206-
<configuration>
180+
</configuration>
181+
<executions>
182+
<execution>
183+
<id>bundling-for-windows</id>
184+
<phase>package</phase>
185+
<goals>
186+
<goal>package</goal>
187+
</goals>
188+
<configuration>
207189
<platform>windows</platform>
208190
<createZipball>true</createZipball>
209-
</configuration>
210-
</execution>
211-
<execution>
212-
<id>bundling-for-linux</id>
213-
<phase>package</phase>
214-
<goals>
215-
<goal>package</goal>
216-
</goals>
217-
<configuration>
191+
</configuration>
192+
</execution>
193+
<execution>
194+
<id>bundling-for-linux</id>
195+
<phase>package</phase>
196+
<goals>
197+
<goal>package</goal>
198+
</goals>
199+
<configuration>
218200
<platform>linux</platform>
219201
<createTarball>true</createTarball>
220202
<jdkPath>X:\\path\to\linux\jdk</jdkPath>
221-
</configuration>
222-
</execution>
223-
<execution>
224-
<id>bundling-for-mac</id>
225-
<phase>package</phase>
226-
<goals>
227-
<goal>package</goal>
228-
</goals>
229-
<configuration>
203+
</configuration>
204+
</execution>
205+
<execution>
206+
<id>bundling-for-mac</id>
207+
<phase>package</phase>
208+
<goals>
209+
<goal>package</goal>
210+
</goals>
211+
<configuration>
230212
<platform>mac</platform>
231213
<createTarball>true</createTarball>
232214
<jdkPath>X:\\path\to\mac\jdk</jdkPath>
233-
</configuration>
234-
</execution>
235-
</executions>
215+
</configuration>
216+
</execution>
217+
</executions>
236218
</plugin>
237219
```
238220

0 commit comments

Comments
 (0)