Wiki source code of maven-japplication-plugin

Last modified by Andrus Adamchik on 2007/02/27 09:12

Show last authors
1 == Description ==
2
3 "maven-japplication-plugin" is a plugin for assembling native launchers of Java applications for a number of target platforms. It will package current project artifact and all its declared and transitive dependencies into the launcher. Currently supports native launchers for Mac and Windows operating systems and also a "java launcher" - a single jar file that can be run via "java -jar file.jar".
4
5 "maven-japplication-plugin" is based on a [[JApplication Ant task>>doc:WOL.Home.WOProject-Ant.JApplication.WebHome]] and has similar capabilities, however the Maven environment provides more information about the project, so plugin has fewer required parameters.
6
7 == OS Requirements ==
8
9 OS requirements are similar to those for [[JApplication Ant task>>doc:WOL.Home.WOProject-Ant.JApplication.WebHome]], i.e. Mac launcher can only be built on Mac, and Windows launcher - on Windows.
10
11 == Goals ==
12
13 === {{code language="none"}}org.objectstyle.woproject.maven2:japplication:japplication{{/code}} ===
14
15 "japplication" is the only defined goal. Its purpose is to assemble a java launcher. It has the parameters described below. The difference from JApplication Ant task is in smarter defaults.
16
17 |=(((
18 Parameter
19 )))|=(((
20 Description
21 )))|=(((
22 Required
23 )))|=(((
24 Default
25 )))|=(((
26 Platforms
27 )))
28 |(((
29 name
30 )))|(((
31 The name of the application without OS-specific extension
32 )))|(((
33 No
34 )))|(((
35 {{code language="none"}}${project.artifact.artifactId{{/code}}}
36 )))|(((
37
38 )))
39 |(((
40 mainClass
41 )))|(((
42 Main Java class
43 )))|(((
44 Yes
45 )))|(((
46
47 )))|(((
48
49 )))
50 |(((
51 os
52 )))|(((
53 A family of operating systems. Currently supported values are "mac", "windows" and "java"
54 )))|(((
55 No
56 )))|(((
57 Build machine OS, if omitted; if the os is not supported, will use "java".
58 )))|(((
59
60 )))
61 |(((
62 destDir
63 )))|(((
64 A destination directory where the application launcher should be installed
65 )))|(((
66 No
67 )))|(((
68 {{code language="none"}}${project.build.directory{{/code}}} - usually {{code language="none"}}"target/"{{/code}}
69 )))|(((
70
71 )))
72 |(((
73 longName
74 )))|(((
75 An optional string identifying the application human-readable name. If not specified, "name" is used.
76 )))|(((
77 No
78 )))|(((
79 {{code language="none"}}${project.artifact.artifactId}-${project.artifact.version{{/code}}}
80 )))|(((
81
82 )))
83 |(((
84 icon
85 )))|(((
86 Platform-specific icon file (usually "*.ico" on Windows and "*.icns" on Mac)
87 )))|(((
88 No
89 )))|(((
90
91 )))|(((
92 mac,windows
93 )))
94 |(((
95 jvm
96 )))|(((
97 Minimal version of the Java Virtual machine required.
98 )))|(((
99 No
100 )))|(((
101 {{code language="none"}}
102 1.4+
103 {{/code}}
104 )))|(((
105 mac
106 )))
107 |(((
108 jvmOptions
109 )))|(((
110 Optional parameters to pass to the JVM, such as memory settings, etc.
111 )))|(((
112 No
113 )))|(((
114
115 )))|(((
116 mac,windows
117 )))
118 |(((
119 version
120 )))|(((
121 Product version string
122 )))|(((
123 No
124 )))|(((
125 {{code language="none"}}${project.artifact.version{{/code}}}
126 )))|(((
127 mac
128 )))
129
130 == Examples ==
131
132 A POM that builds a Foo application on Mac. All declared and transitive dependencies (not shown here) will be included in Foo.app automatically:
133
134 {{code title="pom.xml"}}
135 <?xml version="1.0" encoding="UTF-8"?>
136 <project xmlns="http://maven.apache.org/POM/4.0.0"
137 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
138 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
139
140 ...
141 <build>
142 <plugins>
143 <plugin>
144 <groupId>org.objectstyle.woproject.maven2</groupId>
145 <artifactId>maven-japplication-plugin</artifactId>
146 <configuration>
147 <name>Foo</name>
148 <mainClass>org.example.foo.Main</mainClass>
149 <os>mac</os>
150 </configuration>
151 <executions>
152 <execution>
153 <phase>package</phase>
154 <goals>
155 <goal>japplication</goal>
156 </goals>
157 </execution>
158 </executions>
159 </plugin>
160 </plugins>
161 </build>
162 </project>
163
164 {{/code}}