English 中文(简体)
JavaFX with Maven [closed]
原标题:

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

I recently started a JavaFX project, and I d like to use Maven as my compiler/deployment tool.

Is there a good tutorial or plugin to integrate JavaFX and Maven?

问题回答

Starting with Java 7u9 I think JavaFX is shipped together with Java SE runtime and the rest, so it makes it pretty easy to create a Maven-based JavaFX project.

Here is what you do (assuming you have latest Java SE 7 runtime environment):

  1. Go to directory where your JRE libs are installed: cd "/c/Program Files/Java/jre7/lib"

  2. Find what is the version of the JavaFX by reading the javafx.properties file. cat javafx.properties will produce something like: javafx.runtime.version=2.2.3

  3. Now you are ready to install the JavaFX runtime package to Maven: mvn install:install-file -Dfile=jfxrt.jar -DgroupId=com.oracle -DartifactId=javafx -Dpackaging=jar -Dversion=2.2.3

  4. Finally, create a simple Maven project, in say NetBeans, open your pom.xml file and add the following dependency:


<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>javafx</artifactId>
  <version>2.2.3</version>
</dependency>

Once you save the pom.xml you can continue using your typical Maven workflow.

Please note I used the MSYS (http://www.mingw.org) environment on Windows in the examples above in the case you get confused. If you prefer Windows CMD it would be very much similar. I just do not feel comfortable without BASH and GNU tools such as sed, grep, etc...

This helped me a lot:

Blog Entry

In the beginning of the Blog Entry the author mentions another great Article that can be found here...:

Another Blog

The main "magic" is getting "settings.xml" right... Afterwards...it is not that difficult.

I released a new version of the FEST JavaFX Compiler Maven Plug-in. This new version supports compilation of test sources. For more details please visit http://alexruiz.developerblogs.com/?p=1197

There is a maven plugin developped by an user of javafx.

See this mailling post :

http://mail.openjdk.java.net/pipermail/openjfx-dev/2012-October/003969.html

and the github site :

https://github.com/zonski/javafx-maven-plugin

Alex Ruiz had a really good post on this recently and released a Maven plugin that should help you:

http://alexruiz.developerblogs.com/?p=725





相关问题
Derby gets stuck closing?

I ve got unit tests (in maven) that use derby. At the end of the test run, there is a very long pause, with these log messages before the pause. INFO: Closing Hibernate SessionFactory Nov 16, 2009 8:...

Execute goal on parent after children complete

I have a multi-module maven project (several levels of nesting). Normally, when I execute a maven build (like mvn install or whatever), maven will run all the goals for the parent project before ...

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into ...

Java Equivalent of distcc

Distcc makes it easy to distribute a C or C++ compile job across a number of machines, and is a godsend for working with large, frequently-built codebases. An increasing number of our large projects ...

Maven Assembly Problem

I have a maven multiple-module project, which is giving me headaches in the assembly:assembly phase. I have a module which has an assembly defined in it which works fine when I invoke mvn assembly:...

热门标签