Wiki source code of maven-japplication-plugin

Version 33.1 by Andrus Adamchik on 2007/02/27 09:12

Hide last authors
Andrus Adamchik 11.1 1 == Description ==
2
Andrus Adamchik 33.1 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". --
Andrus Adamchik 31.1 4
Andrus Adamchik 33.1 5 "maven-japplication-plugin" is based on a [[JApplication Ant task>>JApplication]] and has similar capabilities, however the Maven environment provides more information about the project, so plugin has fewer required parameters.
Andrus Adamchik 31.1 6
Andrus Adamchik 33.1 7 == OS Requirements ==
Andrus Adamchik 31.1 8
Andrus Adamchik 33.1 9 OS requirements are similar to those for [[JApplication Ant task>>JApplication]], i.e. Mac launcher can only be built on Mac, and Windows launcher - on Windows.
10
Andrus Adamchik 31.1 11 == Goals ==
12
Andrus Adamchik 33.1 13 === ##org.objectstyle.woproject.maven2:japplication:japplication## ===
Andrus Adamchik 31.1 14
Andrus Adamchik 33.1 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 |=Parameter|=Description|=Required|=Default|=Platforms
18 |name|The name of the application without OS-specific extension|No|##$project.artifact.artifactId##|
19 |mainClass|Main Java class|Yes| |
20 |os|A family of operating systems. Currently supported values are "mac", "windows" and "java"|No|Build machine OS, if omitted; if the os is not supported, will use "java".|
21 |destDir|A destination directory where the application launcher should be installed|No|##$project.build.directory## - usually ##"target/"##|
22 |longName|An optional string identifying the application human-readable name. If not specified, "name" is used.|No|##$project.artifact.artifactId-$project.artifact.version##|
23 |icon|Platform-specific icon file (usually ".ico" on Windows and ".icns" on Mac)|No| |mac,windows
24 |jvm|Minimal version of the Java Virtual machine required.|No|##1.4+##|mac
25 |jvmOptions|Optional parameters to pass to the JVM, such as memory settings, etc.|No| |mac,windows
26 |version|Product version string|No|##$project.artifact.version##|mac
27
Andrus Adamchik 31.1 28 == Examples ==
29
Andrus Adamchik 33.1 30 A POM that builds a Foo application on Mac. All declared and transitive dependencies (not shown here) will be included in Foo.app automatically:
Andrus Adamchik 31.1 31
32 {{code title="pom.xml"}}
33 <?xml version="1.0" encoding="UTF-8"?>
34 <project xmlns="http://maven.apache.org/POM/4.0.0"
35 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
36 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
37
38 ...
39 <build>
40 <plugins>
41 <plugin>
42 <groupId>org.objectstyle.woproject.maven2</groupId>
43 <artifactId>maven-japplication-plugin</artifactId>
44 <configuration>
Andrus Adamchik 33.1 45 <name>Foo</name>
46 <mainClass>org.example.foo.Main</mainClass>
Andrus Adamchik 31.1 47 <os>mac</os>
48 </configuration>
49 <executions>
50 <execution>
51 <phase>package</phase>
52 <goals>
53 <goal>japplication</goal>
54 </goals>
55 </execution>
56 </executions>
57 </plugin>
58 </plugins>
59 </build>
60 </project>
61
62 {{/code}}