/* * Copyright 2012 Daniel Zwolenski. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zenjava.javafx.maven.plugin; import com.oracle.tools.packager.Log; import com.sun.javafx.tools.packager.PackagerLib; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; /** * Base Mojo that any other Mojo wanting to access the JavaFX Packager tools should extend from. This provides * convenience methods for accessing the JavaFX Packager tools in a standard and simple way. */ public abstract class AbstractJfxToolsMojo extends AbstractMojo { /** * The Maven Project Object * * @parameter property="project" * @required * @readonly */ protected MavenProject project; /** * Flag to turn on verbose logging. Set this to true if you are having problems and want more detailed information. * * @parameter property="jfx.verbose" default-value="false" */ protected Boolean verbose; /** * The main JavaFX application class that acts as the entry point to the JavaFX application. * * @parameter property="jfx.mainClass" * @required */ protected String mainClass; /** * The 'app' output directory. This is where the base executable JavaFX jar is built into, along with any dependent * libraries (place in the 'lib' sub-directory). The resulting JAR in this directory will be ready for distribution, * including Pre-Loaders, signing, etc. This JAR will also be the one bundled into the other distribution bundles * (i.e. web or native) if you run the relevant commands for that. *
* This defaults to 'target/jfx/app' and in most cases there is no real need to change this. * * @parameter property="jfx.jfxAppOutputDir" default-value="${project.build.directory}/jfx/app" */ protected File jfxAppOutputDir; /** * The name of the JavaFX packaged JAR to be built into the 'app' directory. By default this will be the finalName * as set in your project with a '-jfx' suffix. Change this if you want something nicer. Note, that changing this * value does not affect the regular old, non-JFX modified JAR (built in the 'target' directory). * * @parameter property="jfx.jfxMainAppJarName" default-value="${project.build.finalName}-jfx.jar" */ protected String jfxMainAppJarName; /** * The directory contain deployment specific files, such as icons and splash screen images. This directory is added * to the classpath of the Mojo when it runs, so that any files within this directory are accessible to the * JavaFX packaging tools. *
* This defaults to src/main/deploy and typically this is good enough. Just put your deployment specific files in * this directory and they will be automatically picked up. *
* The most common usage for this is to provide platform specific icons for native bundles. In this case you need * to follow the convention of the JavaFX packaging tools to ensure your icons get picked up. * *