Skip to main content

JCP/JavaEE Artifacts in Maven Central

Posted by edburns on September 2, 2011 at 2:43 PM PDT

JCP/JavaEE Artifacts in Maven Central

As mentioned in the Editor’s Blog, java.net artifacts are finally available in Maven Central. This includes the official JCP/JavaEE artifacts, being published by the official steward of Java technology. This blog entry brings to your attention a few points about using these artifacts, as well as introducing a simple archetype that the Mojarra team uses to facilitate the creation of automated regression tests.

I am not at all in the position to comment on maven best practices, but one problem I’ve run into is the effect of bitrot on a maven build. This can sometimes result in a complicated assortment of repository entries leading to the lack of a clear understanding of how your dependencies are being satisfied. Now that the official JavaEE artifacts are all in maven central, you can omit the repository declaration entirely from your projects, relying on a mirror declaration in your settings.xml file, if necessary. If you are developing a Java EE 6 application, all of the compile time dependencies can be satisfied from a single artifact, in maven central.

  1. >
  2.   >
  3.     >javax>
  4.     >javaee-api>
  5.     >6.0>
  6.     >provided>
  7.   >
  8. >

It is important to note that this dependency was declared with <scope>provided</scope> This is the only way you can use this dependency because the jar has been stripped of all java code and contains only signatures. The actual implementation of JavaEE 6 comes, naturally, from your Java EE 6 compliant container.

If you would rather go à la carte, the individual artifacts for all of the JavaEE technologies are also available, as listed in these tables. The first table lists artifacts that conform to the naming scheme Oracle Architect, and JavaEE Titan, Bill Shannon. The scheme is documented at <http://wikis.sun.com/display/GlassFish/Maven+Versioning+Rules>.

Technology
groupId
artifactId
version
JSR-299 Contexts and Dependency Injection for JavaEE
javax.enterprise
javax.cdi-api
1.0
JSR 314 JavaServer Faces
javax.faces
javax.faces-api
2.1
JSR 330 Dependency Injection for Java
javax.inject
javax.inject
1
JSR 316 Java EE 6
javax
javaee-api
6.0
JSR 919 Java Mail
javax.mail
javax.mail-api
1.4.4
JSR 315 Java Servlet
javax.servlet
javax.servlet-api
3.0.1
JSR 245 Java Servlet
javax.servlet.jsp
javax.servlet.jsp-api
2.2.1

The remaining jars do not conform to the naming scheme, but are useful for compilation nonetheless.

Technology
groupId
artifactId
version
JSR 925 JavaBeans Activation Framework
javax.activation
activation
1.1.1
JSR 250 Standard JavaEE Annotations
javax.annotation
jsr250-api
1.0
JSR 107 JCache
javax.cache
cache-api
0.2
JSR 188 Delivery Context
javax.ccpp
ccpp
1.0
(pre JCP JSR) Java Communications API
javax.comm
comm
3.0-u1
JSR 220 Enterprise Java Beans
javax.ejb
ejb-api
3.0
JSR 341 Expression Language
javax.el
el-api
2.2
JSR 52 JSP Standard Tag Library
javax.servlet
jstl
1.2
JSR 97 JavaHelp
javax.help
javahelp
2.0.05
JSR 208 Java Besiness Integration
javax.jbi
jbi
1.0
JSR 283 Java Content Repository API
javax.jcr
jcr
2.0
JSR 243 Java Data Objects 2
javax.jdo
jdo2-api
2.2
JSR 914 Java Messaging Service
javax.jms
jms-api
1.1-rev-1
JSR 181 Web Services Metadata for Java
javax.jws
jsr181-api
1.0-MR1
JSR 77 Java Management API
javax.management.j2ee
management-api
1.1-rev-1
JSR 317 Java Persistence
javax.persistence
persistence-api
1.0.2
JSR 286 Java Portlet
javax.portlet
portlet-api
2.0
JSR 322 Java EE Connector
javax.resource
connector-api
1.6-alpha-1
JSR 32: JAIN SIP API Specification
javax.sdp
nist-sdp
1.0
JSR 115 Java Authorization Contract for Containers API
javax.security
security-api
1.1-rev-1
JSR 240 JAIN SLEE
javax.slee
jainslee-api
1.1
JSR 907 Java Transaction API
javax.transaction
transaction-api
1.1-rev-1
JSR 303 Bean Validation
javax.validation
validation-api
1.0.0.GA
JSR 311 Java API for RESTful Web Services
javax.ws.rs
jsr311-api
1.1.1
JSR 222 Java Architecture for XML Binding
javax.xml.bind
jaxb-api
2.2.4
JSR 105 XML Digital Signature APIs
javax.xml.crypto
jsr105-api
1.0.1
JSR 206 Java API for XML Processing
javax.xml.parsers
jaxp-api
1.4.2
JSR 93 Java API for XML Registries
javax.xml
jaxr-api
1.0_04
JSR 101 XML RPC
javax.xml
jaxrpc-api
1.1
XML Web Services
javax.xml
jaxws-api
2.0EA3
JSR 173 Streaming API for XML
javax.xml.stream
stax-api
1.0-2
JSR 67 XML Messaging
javax.xml.soap
saaj-api
1.3.4
JSR 196 Java Authentication Service
Provider Interface for Containers
javax.xml
webservices-api
2.1-b16
JSR 224 XML-Based Web Services
javax.xml.ws
jaxws-api
2.2.6

If you want to use JSF 2.1, which was released after JavaEE 6, it is necessary to explicitly place a compile time dependency on that artifact before the javaee-api 6.0 dependency.

  1. >
  2.   >
  3.     >javax.faces>
  4.     >javax.faces-api>
  5.     >2.1>
  6.     >provided>
  7.   >
  8.  
  9.   >
  10.     >javax>
  11.     >javaee-api>
  12.     >6.0>
  13.     >provided>
  14.   >
  15. >

Oracle GlassFish Server 3.1.1 <http://glassfish.org/> contains an implementation of JSF 2.1.

Archetypes That Use The Artifacts

Because we now have these artifacts in maven central, it is possible for us to finally add archetypes that use them. This first archetype creates a simple war project that depends on JSF 2.1 and JavaEE 6.

 mvn archetype:generate -DarchetypeGroupId=javax.faces -DarchetypeArtifactId=javax.faces-war-archetype -DarchetypeVersion=2.1 

A subsequent post will document the use of another artifact, for the very latest JSF version, 2.2-SNAPSHOT.

This blog entry signifies the culmination of the effort of many individuals from many disciplines over the ears. I would like to thank them all for finally allowing official Java jars to flow into Maven Central.

Technorati Tags:

Related Topics >>

Comments

&nbsp;Nice, but I noticed that JPA 2 is missing.

Nice, but I noticed that JPA 2 is missing.

I've found that having the java code stripped from these ...

I've found that having the java code stripped from these jars makes them quite useless in a real project because any unit tests that reference associated code cannot be executed.

Thanks for your interest and feedback.&nbsp; If you want ...

Thanks for your interest and feedback.  If you want code that executes, rather than just compiles, then you need to place a dependency on a specific implementation of JSF.  For Mojarra that is groupId: org.glassfish artifact: javax.faces version: 2.1.3.

 

Ed

Hello Ed, if I program against the interfaces and mock ...

Hello Ed,

if I program against the interfaces and mock the concrete implementation, then the javaee apis from are pretty useless. Instead I use javaee apis from geronimo as they are not stripped.

Why is it necessary to make apis useless?