JavaFX with Maven [closed] - maven-2

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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.
Improve this question
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):
Go to directory where your JRE libs are installed: cd "/c/Program
Files/Java/jre7/lib"
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
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
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

Related

Are there any gradle plugins for WiX? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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 2 years ago.
Improve this question
Are there any gradle plugins for WiX which are available to the public?
By searching the web, I only found some references to the artifactory server of echocat.org where some maven wix plugin is referenced. But the files stored there seem to be non-public since a username/password is required for viewing and downloading. So I could not check if these maven plugin might also be used within a gradle build process.
You can try the SetupBuilder Gradle plugin. We are working on a Gradle plugin that will create setups for Windows, OSX and Linux. It use the WiX Toolset on Windows to build a *.msi setup file from the settings in the Gradle script. And other tools on the other platforms.
Edit: In the meantime the plugin has a stable version 1.5 and can be used in production.
There is a new tool being developed: jpackage - and it uses WiX for building MSI packages for Windows
If your project is build using Gradle then you can easily use the Badass jlink plugin: https://github.com/beryx/badass-jlink-plugin
to build an installer / package using jpackage with a bundled JVM
Here's an article how to build an app image using OpenJDK 11 and using OpenJDK 14 with jpackage only for building the installer / package:
https://walczak.it/blog/distributing-javafx-desktop-applications-without-requiring-jvm-using-jlink-and-jpackage
I have not been able to find any either; it doesn't appear they exist. I need to use WiX as part of our build process as well.
My plan is to download the WiX distribution as a dependency, extract it and then create Exec tasks to run candle.exe and light.exe directly.
From the research a co-worker has done, these tools are stand-alone so we should be able to run them right from where ever we extract them in the build directory. I'll let you know how it goes and post updates here with examples as I get something working.
If we start using more functionality in WiX, I will probably move my work into an open-source gradle-wix-plugin.
Try the javafx plugin for JDK 8 to JDK 10.
https://github.com/FibreFoX/javafx-gradle-plugin
Otherwise, I make an Exec task to run the packager tool included in the JDK. It will use WiX to produce a .msi file.
For Java 8,9,10 use javapackager
For Java 11 your out of luck - have Java 10 installed just for the javapackager command
For Java 12 will have a jpackage replacement
Check out the org.beryx.jlink plugin.
It relies on jpackager, which uses WiX for Windows builds.

Adding external libraries to project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
In my case I'm developing a Java web app and I want to add the Jersey JAX-RS API, but this question is general:
Is there any recommended/professional/best way to add external APIs to our projects?
I mean, in my university projects I always just import the jar files into my project in Eclipse/NetBeans, but I was wondering if there's a more professional way, also regarding to licenses and so on...
More professional way is to use Dependency Management Tools like Gradle, Maven, Ivy etc for your project.
Maven
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17.1</version>
</dependency>
Gradle
'com.sun.jersey:jersey-server:1.17.1'
Ivy
<dependency org="com.sun.jersey" name="jersey-server" rev="1.17.1"/>
After this, there is single place in your project when all external libraries/apis are defined. There is very easy to check what you are using, much easier than looking inside JAR file for additional information.

Useful maven plugins [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Best “General Purpose” Maven plugins
Which are some of the most useful (and maybe not so well-known) maven plugins that you've used? Time and time again during development I stumble upon a plugin through Google that makes my life a lot easier and I didn't know existed.
Here are a couple I just used recently:
YUI compressor plugin
Build number generator plugin
Jetty plugin , very useful when functional tests are part of the build.
License plugin , for managing and enforcing source licenses
I like Sonar which is more than just a plugin. It offers a complete dashboard and overview of several code quality metrics.
DBUnit plugin
Cobertura plugin
Cargo plugin
Tomcat plugin

Eclipse PDE: How to add java project's classpath to a plug-in's classpath?

People,
I already searched a lot but I'm not finding my answer..
I did a eclipse plugin that writes junit test cases from source code.
By now, I'm starting to use reflection in my code, but the plugin can't find the classes in the java project being tested!
Is there a way to use the selected project classpath in my plug-in? How??
I've seen many questions like mine out there, but with no answers. Please someone help!
you could perhaps try to write programmatically a launch configuration that includes in the classpath both your plugin source code and the project source code.
By doing this way you should provide a valid entry point to your application.
this article explains how
Otherwise you could try to base your plugin on eclipse jdt using the Abstract Syntax Tree that jdt provides to generate the unit tests.
ref eclipsepedia

Buildr, Gradle or wait for Maven 3? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am really tired of struggling with Maven 2 all the time. Build tools should not be in the way. Recently I have been looking at Buildr and Gradle. Maven 3 seems to fix some of the struggles. So, what should I go for now? Buildr? Gradle? Or wait a year for Maven 3?
I wouldn't expect too much from Maven 3. The people behind the Maven pedigree of build tools have always held the assumption that project builds are homogeneous, that is: all build problems fundamentally boil down to the same problem. This view of the world can be held fairly consistently in the face of opposing views but comes at a cost. The absence of scripting logic in Maven ("when you want to script you know you're doing something wrong"), the cumbersome plugin API ("no ordinary Maven user should want to write a plugin") and the central repository ("we all have the same dependencies") are all testaments of this overarching assumption.
In the real world build problems are heterogeneous because people build software for a wide variety of reasons. They all 'develop' like we all 'drill holes' once in a while for solving unique problems. Regardless of your level of abstraction you'll always find similarities when comparing arbitrary build problems. It is the reveration of these similarities and the condemnation of differences that is the downfall for Maven's design and the reason why it draws so much flak. Basically, Maven is authoritarian and utopian in its outlook.
PS: Maven has good features, like convention-over-configuration and the idea of using repositories (the Maven implementation of this idea is troublesome).
No build system is a magic bullet. I find Maven solves more problems than it causes for me, but I'm quite comfortable writing plugins to get round its shortcomings, I also deal with hundreds of projects, so Maven's inheritance and dependency processing is quite helpful for me.
Browse SO a bit and you'll see Buildr and Gradle both have issues too (same for Ant and Ivy), generally you're trading one set of problems for another and its a case of finding the least painful.
Is there anything in particular that is bothering you about Maven or is it a general itch? If it is a particular problem it is worth looking at the Maven 3 issues on Jira, if the problem isn't addressed, you can raise it, or else there may be little point in you waiting
We use Maven here, but I find that once you get outside of a simple project, the pom.xml starts to get more and more complex. You start spending a lot of time working out how in the heck to configure your pom to do what you want, and how to work around the various issues.
The thing that really got me was the ear we're building. We have multiple wars in that ear file, and Maven normally sticks the libraries in the wars. However, to reduce the size of the wars, and to keep the jars all the same, we wanted to put the jars shared between the wars in the ear's lib directory.
Unfortunately, Maven doesn't handle this very well. We needed to manually configure this for each of the wars' poms, and then add all of these dependencies into the ear's pom.
In another project we have HTML based help files. The people who write the help write them in Microsoft Word then use a program to translate them into HTML. A single character change can reverberate throughout hundreds of files.
To get around this issue, our help system is stored in our source repository as a single zipped file. When our documentation team creates a new set of help files, they zip it up and replace what is in the repository.
So, part of my build is unzipping this file and placing it in the war. Easy to do in Ant, can't do it in Maven unless you use the Antrun plugin which allows you to write Ant code to handle issues that Maven cannot handle without a full blown plugin.
I can see what Maven is doing, but theory got ahead of reality. What I found is that Ivy and Ant can do most of the dependency checking that Maven does without all the issues of writing and maintaining the poms.
If you're not already using Maven, try Ant with Ivy first. Then when, Maven 3 comes out, try that. I remember the transition from Maven 1 to Maven 2. They were entirely incompatible with each other and anything you learned using Maven 1 was obsolete. It would be silly to learn and redo your projects in Maven 2 to suddenly find yourself redoing everything for Maven 3.
maven 3.x is already embedded in IDEs (at least on netbeans, check this link for more infomration). You can play today with maven 3.x simply building a Maven project with netbeans.
Another nice news is that maven got more 'enterprise' support with integrating EJB/WS in IDE projects (again, at least on netbeans).
So I would stick to maven 2.x for production builds and play with maven 3.x for development.
Maven 2 and 3 have both been working perfectly for me on a variety of projects. I am currently using Maven 3 alpha 7 which works very well, especially in conjunction with the Eclipse Maven plugin.
Maven integrates seamlessly with Ant - in both directions. In my current project, we invoke Maven from Ant multiple times in order to perform complex integration test. Likewise, we use Ant via Maven's AntRun plugin, and we also wrote our own Maven plugins. This, by the way, is a matter of minutes and boils down to writing an annotated Pojo.
Maven gets a lot of flak because many developers don't like rules or conventions. Quite simply, nobody forces you to use Maven. If you want ultimate freedom - by any means - re-write your own build process for every project you join. However, if you like to create software rather than re-inventing the wheel with a custom-made build process on every project, go for Maven.
Keep your code well maintained and broken into well defined modules and porting between build systems becomes a minor problem.
As for now, maven-2 is a good choice for the middle 2/3rd of projects. For the really simple, ant is still ok. For the really complex, a hybrid of maven-2 and other tools (like antrun) becomes inevitable.
Not sure why you are having problems with maven-2.
It differs from ant and buildr in that it is a tool for describing your build process, not scripting it. Complex builds, the ones with multiple dynamic parts and nested and/or transient dependencies are hard to build because they are hard to describe.
Give Lattice https://github.com/hackingspirit/Lattice a try. I am the author. Here is the scoop:
In Lattice build files are written not in XML, but in the Python language. The ben- efits are much better readability and powerful imperative build scripting supported by Python.
For multi-module projects. Lattice uses topological sorting to decide the correct order to build each module. It’s also planned that Lattice will analyze the module dependency to determine how the module compilation can be parallelized.
Lattice’s source code is extremely lean, currently it consists of about 500 lines of Python source code.
I think people complaining about Maven should spend a little extra time investigating available plugins. In response to comments complaining that Maven is rigid and makes it hard to use custom build logic / provide fine-grained control over the build process - I would recommend looking into Ant plug-in for Maven (there are actually several, but here is one: http://maven.apache.org/plugins/maven-antrun-plugin). I have had great success customizing Maven builds with it over the years. Basically, it allows you to run any Ant command as part of the Maven build, and you can do pretty much anything with Ant ;)
Ant with Ivy does the same dependency management Maven does (in fact, it uses Maven's whole dependency management infrastructure including the same URL repositories), but without all the POM configuration mess.
Ant with Ivy might be a way of handling the dependency issues for people who really don't want to use Maven. It solves 90% of the stuff that Maven was suppose to solve.