Did you know that Java EE 7 APIs are now published in maven ?
The complete set of coordinates are described
here. So how do you build a simple Java EE 7 maven
application ?
- Generate the ususal Java EE 6 maven application as:
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5 -DarchetypeRepository=http://repo.maven.apache.org/maven2 -DgroupId=org.glassfish -DartifactId=hello-javaee7 -Dversion=1.0-SNAPSHOT -Dpackage=org.glassfish.hellojavaee7 -Darchetype.interactive=false --batch-mode archetype:generate
- In the generated pom.xml, replace
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>with
<repositories>
<repository>
<id>Java EE 7</id>
<url>https://maven.java.net/content/groups/promoted/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0-b72</version>
</dependency>
</dependencies>
Notice, there is a new <version> of dependency for each GlassFish 4 promoted build. This may be simplified in the coming builds.
The <artifactId> can be changed tojavaee-web-api
if your application requires Java EE 7 Web Profile API only.
And now all Java EE 7 APIs so far integrated in GlassFish are
available in your application.
You can also include specific API JAR files explicitly in your
project directly. The latest APIs are available in the format:
- Java EE 7 Full Platform: http://download.java.net/glassfish/4.0/promoted/javaee-api-7.0-b72.jar
- Java EE 7 Web Profile: http://download.java.net/glassfish/4.0/promoted/javaee-web-api-7.0-b72.jar
- Corresponding javadocs: http://download.java.net/glassfish/4.0/promoted/javaee-web-api-7.0-b72-javadoc.jar
In general, you can replace "b72" in the URL with the latest
promoted build number to get the latest artifacts. A simplified
URL for the latest set of these artifacts is in the works!
What next ? Maven archetype and support in NetBeans
coming soon!