15 September 2010

How to get Java EE6 libraries

If you want to download Java EE6 libraries, Oracle bundles the whole glassfish server, and more with the java EE6 SDK. Other application servers also bundle the libraries.
That’ a whole lot of bloat if you just want to compile a little webapp. You can just put a small subset of the glassfish jars in your classpath:

  • glassfish_install_dir/glassfish/modules/javax.servlet.jar
  • glassfish_install_dir/glassfish/modules/javax.servlet.jsp.jar
  • glassfish_install_dir/glassfish/modules/javax.servlet.jsp.jstl.jar 
  • glassfish_install_dir/glassfish/modules/jstl-impl.jar
  • glassfish_install_dir/glassfish/modules/javax.ejb.jar (if using ejb)
If you are using maven this is not so much of a problem, just add a dependency to your POM.
<dependencies>
  <dependency>
    <groupId>javaee</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
  </dependency>
</dependencies>
<repository>
   <id>java.net</id>
   <name>GlassFish Maven Repository</name>
   <url>http://download.java.net/maven/2</url>
</repository>
Use artifactId javaee-web-api if you just want the web profile.
If you are not using maven, you can just download the jars from the maven repository:
For Java EE5 that is:
<dependency>
  <groupId>javaee</groupId>
  <artifactId>javaee-api</artifactId>
  <version>5</version>
  <scope>provided</scope>
</dependency>

No comments:

Post a Comment