Bug 247290 - Update Maven JavaFX Application template
Update Maven JavaFX Application template
Status: NEW
Product: javafx
Classification: Unclassified
Component: Project
8.0.1
PC Windows 7
: P3 with 2 votes (vote)
: TBD
Assigned To: Roman Svitanic
issues@javafx
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-19 08:21 UTC by terje7601
Modified: 2015-01-19 08:13 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description terje7601 2014-09-19 08:21:14 UTC
The Maven JavaFX Application template should use the Maven JavaFX Plugin (see [1] & [2]).

There are plenty of advantages:
* only this single plugin is required
* much better performance
** the current pom packs everything into a single .jar, which is very time consuming
* much better robustness
** packing everything into a single .jar is error-prone
** the current pom does all kinds of modifications of the classpath to add jfxrt.jar to it
** the current pom uses the now obsolete javafxpackager
** the current project requires customizations of the Run/Debug actions (in nbactions.xml file)

This is the whole <build> section of my current pom:

<build>
  <plugins>
    <plugin>
      <groupId>com.zenjava</groupId>
      <artifactId>javafx-maven-plugin</artifactId>
      <version>8.1.2</version>
      <configuration>
        <mainClass>my.MainClass</mainClass>
      </configuration>
    </plugin>
  </plugins>
</build>

The only tricky part may be how to select the right version of the plugin, based on the JDK used for the project (see [2], under "Support for 8u20").

(1) http://zenjava.com/javafx/maven/
(2) http://speling.shemnon.com/blog/2014/09/12/maven-javafx-plugin-8-dot-1-released/
Comment 1 terje7601 2015-01-19 08:13:49 UTC
The fundamental problem with the current template, is that it's built to work with Java 7. I think a Maven JavaFX project should require a Java 8 platform. This would allow to greatly simplify the POM template.

Contrary to what I said in my first comment, I don't think it should use the Maven JavaFX Plugin. The current POM is ok, but the invocation of javafxpackager should be replaced with an invocation of javapackager.

Also the "unpack-dependencies" part should be eliminated: it's extremely time-consuming to do on each build & is not necessary either: with Java 8 you can just do "java MainApp" (where MainApp extends javafx.application.Application & does not have a main() method), as with any other class. This also means there should be no need for a special nbactions.xml file.

Also there should be no main() method in the generated JavaFX Application class (see bug 249887).


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo