Skip to content

Commit caefd0d

Browse files
author
kavedaa
committed
Merge pull request #8 from metasim/native-packaging-updates
Native packaging updates
2 parents 37a0776 + 11380ec commit caefd0d

File tree

4 files changed

+44
-33
lines changed

4 files changed

+44
-33
lines changed

doc/other.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
## Other settings
22

3-
### Signing
3+
### Application info
4+
5+
The following keys allow specification of additional metadata for the installer and application manifest. Details are provided in the [fx:info JavaFX Ant Task Reference](http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference.htm#CIAIEJHG).
46

57
```scala
6-
JFX.elevated := true
8+
JFX.vendor := "ACME Inc."
79

8-
JFX.keyStore := Some("path/to/keystore")
10+
JFX.title := "Rocket Launcher"
911

10-
JFX.storePass := Some("mypassword")
12+
JFX.category := "Mission critical"
1113

12-
JFX.alias := Some("myalias")
14+
JFX.description := "Launches rockets"
1315

14-
JFX.keyPass := Some("mykeypass")
16+
JFX.copyright := "ACME 2013"
17+
18+
JFX.license := "ACME"
1519
```
1620

17-
### Application info
21+
### Signing
1822

19-
```scala
20-
JFX.vendor := "ACME Inc."
23+
Application component signing may be required for JNLP, Applet, and native installer deployments, depending on platform and security settings. See the [fx:signjar JavaFX Ant Task Reference](http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference.htm#CIADDAEE) for details.
2124

22-
JFX.title := "Rocket Launcher"
2325

24-
JFX.category := "Mission critical"
26+
```scala
27+
JFX.elevated := true
2528

26-
JFX.description := "Launches rockets"
29+
JFX.keyStore := Some("path/to/keystore")
2730

28-
JFX.copyright := "ACME 2013"
31+
JFX.storePass := Some("mypassword")
2932

30-
JFX.license := "ACME"
33+
JFX.alias := Some("myalias")
34+
35+
JFX.keyPass := Some("mykeypass")
3136
```
37+

doc/packaging.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,26 @@ A typical value for `bundleType` is one of:
4242

4343
See the [JavaFX packaging documentation](http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm) for possible values and further information.
4444

45-
#### Drop-in Resources
45+
### Drop-in Packaging Resources
4646

47-
As described in the [Native Packaging Cookbook](https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_cookbook_using_drop), the native installers generated for each platform may be customized with files copied from the default installer templates (as reported when `verbose="true"` is passed to the `ant deploy` task), and placed in the classpath for the `ClassLoader` associated with `ant-javafx.jar`. This classpath should contain a folder called `package`, where the `deploy` task looks for files with project- and platform-specific files. See the Oracle for specifics, but the base structure is `package/{macosx,windows,linux}/[drop-in-resources]`.
47+
As described in the article [Native Packaging Cookbook](https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_cookbook_using_drop), the native installers generated for each platform may be customized with modified versions of files from the installer templates. The Oracle-provided `fx:deploy` task in `ant-javafx.jar` is not very flexible with regard to this specification of these "drop-in" resources, so tweaking an installer can be frustrating the first time around. Any encountered problems are likely to be associated with mis-named or mis-located files, and *not* a problem with **sbt-javafx**. For an example build configuration, see the `example-packaging` source in the [examples repository](https://github.com/kavedaa/sbt-javafx-examples).
4848

49-
The `JFX.pkgResourcesDir` setting is provided for adding a path to this classpath. For example, if a custom `Info.plist` file for MacOS X is defined in `src/main/resourcespackage/macosx/Info.plist`, the following setting would make it visible to the `deploy` task:
49+
At the heart of the process of specifying the location of drop-in resources is ensuring the classpath of the ClassLoader executing `fx:deploy` can resolve the desired resources. The **sbt-javafx** plugin provides the `JFX.pkgResourcesDir` setting for prepending a path to the `fx:deploy` classpath (which is *not* the same as the SBT classpath or the `scalac` classpath).
50+
51+
For example, if a custom `Info.plist` file for MacOS X is defined in `src/main/resources/package/macosx/Info.plist`, the following setting would make it visible to the `fx:deploy` ant task:
5052

5153
```scala
5254
JFX.pkgResourcesDir := Some(baseDirectory.value + "/src/main/resources")
5355
```
5456

55-
The Oracle-provided `ant-javafx.jar` is not very flexible with regard to paths to drop-in resources, so any encountered problems are likely to be associated with mis-named or mis-located files. To debug the packaging process, set `JFX.verbose := true` in your `build.sbt` file, run `sbt deploy` at least once, and then run `ant` against the generated `target/scala-x.yz/build.xml` file (i.e. `build.xml` in `crossTarget`). Running `ant` with the `deploy` task in verbose mode directly simplifies the debugging process when your drop-in resources aren't being picked up by `ant-javafx.jar`.
56-
57-
#### Using the correct Java version
58-
59-
Self-contained applications must be packaged using the JDK version of the JRE and not the stand-alone JRE. (If you have installed the JDK you will probably have both.) If you use the JRE version, you will get an error message saying "jvm.dll is not found" (on Windows, probably similar on other platforms).
57+
Note that the placement of `Info.plist` in `package/macosx` is a requirement imposed by `fx:deploy`, not **sbt-javafx**.
6058

61-
This means that SBT must be started with the JDK version of the JRE. This can be assured by setting JAVA_HOME to the correct path, either globally or within SBT's `sbt.bat` startup file.
59+
When the `fx:deploy` ant task is run with attribute `verbose="true"`, a list of customizable files is reported to the ant console, and defaults saved to a temporary directory for copying. If customized versions of these files are placed in a specific location in the classpath for `ant-javafx.jar`'s ClassLoader. This classpath should contain a folder called `package`. This is where the `fx:deploy` task looks for files with project- and platform-specific resource files. See the Oracle docs for specifics, but the basic structure is `package/{macosx,windows,linux}/[drop-in-resources]`.
6260

63-
### Java-only applications
61+
To debug the packaging process, set `JFX.verbose := true` in your `build.sbt` file, run `sbt package-javafx` at least once, and then run `ant` against the generated `target/scala-x.yz/build.xml` file (i.e. value of `crossTarget.value + "/build.xml"`). Running `ant` with the `fx:deploy` task in verbose mode simplifies the debugging process when your drop-in resources aren't being picked up by `ant-javafx.jar`, and helps understand what additional resources might be customized. As mentioned, the `fx:deploy` task is fussy about names and locations of these resource files. For example, the name of application replacement icons have to match application name, and the `package/{os-name}/` structure is required.
6462

65-
It is very much possible to use the plugin to package applications written in Java. If your application uses no Scala code at all, you might want to use the `javaOnly` setting:
63+
## Using the correct Java version
6664

67-
```scala
68-
JFX.javaOnly := true
69-
```
65+
Self-contained applications must be packaged using the JDK version of the JRE and not the stand-alone JRE. (On Windows, if you have installed the JDK you will probably have both.) If you attempt to use the JRE version, you will get an error message saying "jvm.dll is not found".
7066

71-
This is a convenience setting that excludes the standard Scala library from being packaged with the application, and makes the output path a bit simpler, so that it becomes e.g. `target/my-javafx-application-1.0/`.
67+
This means that SBT must be started with the JDK version of the JRE. This can be assured by setting `JAVA_HOME` to the correct path, either globally or within SBT's `sbt.bat` startup file. Another option on Windows is to uninstall the JRE and ensure `JAVA_HOME` and applicable `PATH` entries point to the JDK binaries.

doc/paths.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
Two files from the JavaFX SDK are needed by the plugin:
44

5-
* jfxrt.jar (for compiling and running)
6-
* ant-javafx.jar (for packaging)
5+
* `jfxrt.jar` (for compiling and running)
6+
* `ant-javafx.jar` (for packaging)
77

88
The location of the these can be configured in several different ways:
99

doc/running.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SBT is not able to launch a `javafx.application.Application` on its own. It need
44

55
By default, the plugin will set SBT's `mainClass` to the same value as `JFX.mainClass`. This makes it simple to add the necessary launcher code.
66

7-
### Scala-based applications
7+
### Scala-centric applications
88

99
You can use a companion object with a `main` method that has code to launch the JavaFX application, e.g.:
1010

@@ -22,7 +22,7 @@ If you for some reason would want to name this differently, you can override SBT
2222
mainClass in (Compile, run) := Some("some.other.Launcher")
2323
```
2424

25-
### Java-based applications
25+
### Java-centric applications
2626

2727
You can add a static `main` method to your JavaFX application class, e.g.:
2828

@@ -38,3 +38,12 @@ public class MyJavaFXApplication extends Application {
3838
}
3939
```
4040

41+
### Java-only applications
42+
43+
It is very much possible to use the plugin to package applications written in Java. If your application uses no Scala code at all, you might want to use the `javaOnly` setting:
44+
45+
```scala
46+
JFX.javaOnly := true
47+
```
48+
49+
This is a convenience setting that excludes the standard Scala library from being packaged with the application, and makes the output path a bit simpler, so that it becomes e.g. `target/my-javafx-application-1.0/`.

0 commit comments

Comments
 (0)