Tuesday Aug 11, 2015

Maven, Java EE and ... NetBeans

At the beginning, build tools capabilities were relatively simple, i.e. mostly compile and package the compiled sources. But over the years, those capabilities have largely evolved (e.g. complex build processes, dependencies management, documentation generation, testing integration, etc.). And it's probably fair to say that Maven has been, at least in the Java landscape, one of the main actors in that evolution... if not the most important one! Maven is widely used since many years, it's now the de-facto Java build environment. And if you are using another solution (e.g. Graddle), you can't ignore Maven; chances are high that you still have to directly or indirectly use Maven in a way or another (e.g. to integrate a 3rd party framework which uses Maven). 

In his "Truly Unleashing the Power of Maven and Java EE" article, Geertjan Wielenga (NetBeans Product Manager) talks about how well integrated Maven is in the NetBeans IDE. If you haven't used NetBeans and its Maven support, you should read this piece. It's amazing how Maven is supported in NetBeans. It's so nicely integrated that you sometime tend to forget that Maven is used under the hood.

Geertjan then discusses another strength of NetBeans, its Java EE support. He then concludes with "Maven and Java EE are baked into the very essence of what NetBeans IDE is, as its heartbeat, and as its raison d’être". So when you combine NB's deep Maven integration with its outstanding Java EE support, you get a rock-solid (and free!) environment to develop Java EE applications.

Visual representation of a Maven project's depencies in NetBeans

Tuesday Jul 23, 2013

Java EE 7 Maven Repository Coordinates

For those of us doing Java EE development with Maven (which by my own account as a former consultant is pretty much all Java EE/GlassFish adopters), getting our hands on the repository location for Java EE APIs is critically important. Fortunately, Java EE APIs have long been available via Maven central, Java EE 7 is no exception. The Java EE 7 Maven Coordinates on the GlassFish wiki is an extremely handy reference for navigating the Maven Central maze.

It also helps to know that there is a relatively well established set of guidelines for naming Java EE API Maven artifacts. Generally speaking, Java EE Maven artifacts follow this pattern:

    <groupId>[Java EE API package name]</groupId> 
    <artifactId>[Java EE API package name]-api</artifactId>
    <version>[Java EE API version]</version>        

For the most part though, this is the only Maven coordinate you should need for Java EE 7 applications:


If you are using just the Web Profile, you should use this instead:


That being said, for those of you that need/want them, the GlassFish wiki outlines where you can find the Maven artifacts for just Java EE concurrency, JPA 2.1, JAX-RS 2, Servlet 3.1, EL 3.0, JMS 2, JSF 2.2, EJB 3.2, JBatch, JSON-P, WebSocket and others.

It should be pretty straightforward to use - give me a shout if you need help setting up Maven.

Tuesday Apr 16, 2013

Maven projects with GlassFish 4.0 Embedded Plugin


Some specifications related to Java EE 7 already became Final. One example is the JavaServer Faces 2.2 (JSR 344). But you don't have to wait for the release of Java EE 7 and the final version of GlassFish 4.0, which is the reference implementation, to try all the new stuff. I've blogged about Maven and its integration with GlassFish Embedded in a way where you can, with just few steps, create a Java EE 7 and then run GlassFish Embedded 4.0 without installing it.

The good thing about this setup is that you will be "ready-to-go" as soon the Final version is released. All you will need to do will be to update the dependency and the plugin version inside your POM xml file. Now stop reading and start coding: go to my blog post "GlassFish 4 beta and Maven Embedded Plugin" and get started with Java EE 7 TO-DAY!

Wednesday Apr 10, 2013

Java EE 7 Maven Archetype

For those of us doing Java EE development with Maven (which by my own account as a former consultant is pretty much all Java EE/GlassFish adopters), Archetypes can be a great productivity boost, especially while getting started. You will be pleased to know that there is already a Java EE 7 Maven Archetype out there in the https://nexus.codehaus.org/content/repositories/snapshots/ repository (courtesy of GlassFish of course).

You can use it directly from the Maven command-line like so:

mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes 

If you prefer NetBeans, you can do that too. Just define a new repository with the URL https://nexus.codehaus.org/content/repositories/snapshots/ under "Maven Repositories" on the "Services" tab. Then proceed to "New Project -> Maven -> Project from Archetype" and enter "webapp-javaee7" into the search box. Select the 0.1-SNAPSHOT and click "Finish".

Either way, once the project is generated, you can of course tweak the POM and source code to meet your needs. It should be pretty straightforward - give me a shout if you need help getting started. Happy hacking!

Tuesday Feb 19, 2013

Java EE 7 Maven Repository Coordinates

For those of us doing Java EE development with Maven (which by my own account as a former consultant is pretty much all Java EE/GlassFish adopters), getting our hands on the repository location for Java EE APIs is critically important. You will be pleased to know most of the Java EE 7 APIs are available via Maven already to aid in your exploration and early evaluation efforts.

The GlassFish wiki outlines the Maven coordinates for Java EE 7, Java EE concurrency, JPA 2.1, JAX-RS 2, Servlet 3.1, EL 3.0, JMS 2, JSF 2.2, CDI 1.1, Bean Validation 1.1, JBatch, JSON-P, WebSocket and others. It should be pretty straightforward to use - give me a shout if you need help setting up Maven.

Wednesday Aug 29, 2012

GlassFish Server Maven Coordinates

GlassFish Server was released a few weeks ago. This micro release fixed a couple of important bugfixes - one in JAX-WS (JAX-WS-1059) and another one related to JK listener with Apache + mod_ajp_proxy (GLASSFISH-18446). This release is already integrated in NetBeans 7.2 and you can download separately from here.

Maven coordinates for this build are now also described on the download page. The following fragment in your pom.xml will allow you to invoke embedded-glassfish:run, embedded-glassfish:deploy, and other similar commands.


GlassFish Embedded Server Guide provide more details about setup etc.

Similarly full platform or Web profile implementation of GlassFish can be included as a single JAR using


Of course, you need to replace "glassfish-embedded-web" with "glassfish-embedded-all" to get complete platform. 

The download page provide more details different bundles and complete maven coordinates. Or you can get started with the simple zip bundle as well.

Tuesday Apr 10, 2012

Java EE 6 and Maven 3 using CLI

NetBeans and Eclipse provide tools, templates, wizards and code generators for building a Java EE 6 application. They both also allow a Java EE 6 Maven project to be created. In his recent screencast, Adam Bien explained how a Java EE 6 project can be easily created at command-line using Maven 3.

Java EE 6 using Maven 3 Screencast

The screencast walks through the process of creating the project using command-line. The created project has no dependency on NetBeans and GlassFish but can still be opened in NetBeans and deployed on GlassFish.

A complete list of Adam's screencasts are available here. Tons of similar videos are also available on GlassFishVideos channel.

Tuesday Mar 20, 2012

Improved Maven Embedded GlassFish - deploy multiple apps

Bhavani has some new over at java.net about the Maven Plugin for GlassFish and how it now supports the ability to deploy multiple applications. He also has a Tips, Tricks and Troubleshooting entry.


Multiple deployments are done during the Maven pre-integration-test phase but with a goal-specific configuration for app, contextRoot, etc...

The :run (all-in-one) execution also now supports admin and deploy goals. Note that these improvements will require a recent work-in-progress 4.0 version of GlassFish.

Friday Mar 02, 2012

Tab Sweep - ArchBeat java EE podcast, Safer JVM with OSGi, building EE artifacts with Maven, WebSocket vs. REST, Mojarra tests, ...

Recent Tips and News on Java, Java EE 6, GlassFish & more :

Radio Receiver

Why OSGi? Or Why Not Using It Makes Your JVM Runtime Unsafe (Dhananjay)
Monitoring of Web Applications and GlassFish for Performance and Availability – a Parleys.com use Case (SL.com)
Lyon Jug du 21 février 2012 (Serli contributions to Open Source and GlassFish)
How to run the Mojarra automated tests (Arjan)
WebSockets versus REST? (InfoQ)
Build Java Enterprise Edition artifacts with Maven (dafreels)
Podcast Show Notes: Development Debate (ArchBeat blog)
Interview With Mission Impossible Java Hacker--Fabiane Nardon (Adam)
EOL’ing a version of Java Is a Process, Not an Event (Donald)

Some Maven-related changes when building GlassFish

The GlassFish Nexus Server (maven.glassfish.org) is put offline due to some Oracle-internal infrastructure changes.

Given that almost all GlassFish dependencies are available in Maven Central (except for EclipseLink artifacts), if you want to build GlassFish yourself, you'll need to create a mirror element in settings.xml as explained by Jane in her email.


The Build Instructions page is not up-to-date and references to maven.glassfish.org have been removed from the build setup.

Thursday Sep 22, 2011

Build GlassFish with latest Maven & JDK 7... in 5 minutes.

With recent improvements to the GlassFish code base, developers are now able to build the entire GlassFish trunk in only a few minutes.

In addition to all the work that has consistently been done to have a fast and robust build, we're now putting both Maven 3.0.3 as well as JDK 7 to work. This is all fully documented in this GlassFish Full Build Instructions wiki page.


This can only help the entire team deliver promoted and milestone builds for the upcoming GlassFish releases. More on that in another post.

Monday Sep 19, 2011

JPA Maven Plugin - request for feedback

Laird Nelson, a regular poster on the GlassFish forums and a prolific bug reporter (thank you!) recently released a JPA Maven Plugin.

The idea is to generate a .properties file with JPA entities and optional parameters which Maven can later use as a filter to simplify testing of JPA code.


Version 0.9.0 of the plugin is now on Maven Central and Laird is looking for feedback. The issue tracker is here.

Wednesday Sep 07, 2011

Jersey moving forward - Contributions, Maven Central and more in 1.9

Jakub just announced the release of Jersey 1.9, an update to the GlassFish JAX-RS 1.1 implementation. This is the fourth release in six months.


Jersey 1.9 features an externally-contributed WADL improvement, integration of all final artifacts on Maven Central (see this earlier post), async client improvements and more.

On the topic of Java EE and GlassFish artifacts on Maven Central, check out this blog entry by Ed Burns and start getting rid of those <repository> tags.

Friday Aug 26, 2011

maven.java.net, GlassFish and Maven Central

Following-up on a previous entry, and as a result of the collaboration between Oracle and Sonatype on the java.net infrastructure, GlassFish and all its sub-projects (grizzly, mojarra, jersey, javamail, and many more ...) have now all their artifacts on maven central.


Remember that maven.java.net is now powered by Sonatype Nexus and available for all java.net projects to use and for them to also make their way into Maven Central. You can get more details from this page.

See also Kevin's post on this topic over at the java.net editor's blog.