Maven projects¶
For Maven there's no plugin. Instead, Conveyor will discover the JARs in your project by running the output of the mvn
command and using it directly as configuration. Other aspects like project name must be specified explicitly. Better import from Maven is planned in a future release.
Maven on Windows
Currently, automatic import from Maven only works on UNIX. On Windows you'll need to follow the instructions below for "other build systems".
Here's an example of how to package a Maven project:
conveyor.conf | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
- You can import JDKs by major version, major/minor version, and by naming a specific distribution.
- This included file contains a single line, which runs Maven, tells it to print out the classpath and assigns the result to the
app.inputs
key:include "#!=app.inputs[] mvn -q dependency:build-classpath -Dmdep.outputFile=/dev/stdout -Dmdep.pathSeparator=${line.separator}"
. In future this file will be updated to trigger a higher quality Maven import. - The
fsname
is what's used for names on Linux e.g. in thebin
directory, for directories underlib
. In fact when specified the vendor is also used, and the program will be calledglobal-megacorp-my-program
unless thelong-fsname
key is overridden. - You may not need to set this if the display name of your project is trivially derivable from the fsname. The default here would be
My Program
. - This is optional. It'll be prefixed to the display name and used as a directory name in various places; skip it if you don't work for an organization.
- This is where the created packages will look for update metadata.
Adapting a JavaFX app¶
The idea is straightforward - get all the JARs your app needs into a single directory. Below is a config that packages the gallery demo for the modern AtlantaFX skin. Here's the commit that added the packaging. The Maven POM in this project collects all the app JARs into the sampler/target/dependencies
directory when the commands at the top of the file are run by hand. Conveyor can then just pick them up and package them.
// Before packaging do the build like this:
//
// mvn install -pl styles
// mvn install -pl base
// mvn prepare-package jar:jar -pl sampler
// Use a vanilla Java 17 build, latest as of packaging.
include required("/stdlib/jdk/17/openjdk.conf")
// Import JavaFX JMODs.
include required("/stdlib/jvm/javafx/from-jmods.conf")
javafx.version = 18.0.2
app {
display-name = AtlantaFX Sampler
fsname = atlantafx-sampler
// Not allowed to have versions ending in -SNAPSHOT
version = 0.1
// Open source projects use Conveyor for free.
vcs-url = github.com/mkpaz/atlantafx
// Import the JARs.
inputs += sampler/target/dependencies
// Linux/macOS want rounded icons, Windows wants square.
icons = "sampler/icons/icon-rounded-*.png"
windows.icons = "sampler/icons/icon-square-*.png"
jvm {
gui.main-class = atlantafx.sampler.Launcher
modules = [ java.logging, jdk.localedata, java.desktop, javafx.controls, javafx.swing, javafx.web ]
}
site.base-url = downloads.hydraulic.dev/atlantafx/sampler
}
There are several tasks accomplished by this config:
- Import a JDK of the right version from your preferred vendor.
- Import the JavaFX JMODs so the JVM will have it linked in.
- Set the names, versions and get a free license by pointing to the GitHub URL.
- Supply Conveyor with the directory where the app JARs can be found.
- Import icons for macOS and Windows. Icons must be PNG files. You don't have to supply all the sizes.
- Define the main class and the JDK modules (including the javafx modules) that you want to use.
- Define the URL where the packages will look for online updates.
Please see the Gradle page to see how to set your stage icons.