 |
Java EE 5 APIs now in a Maven repository...
Posted by ludo on January 16, 2007 at 08:58 PM | Comments (13)
Bonjour, comment Java?
Finally, the Java EE 5 API jar has been published via a Maven
repository:
Check https://maven-repository.dev.java.net/nonav/repository/javaee/
So if you get this api jar file, you can compile the following class:
import javax.jms.Queue; import javax.persistence.Entity; import javax.mail.Session; public class Foo { public static void main(String[] args) { Queue queue = null; Session.getInstance(null); } }
In a Maven project defined by this pom file: (notice the scope value
which is 'provided')
?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>foo</groupId> <artifactId>bar</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <description>Java source code generation library</description> <dependencies> <dependency> <groupId>javaee</groupId> <artifactId>javaee-api</artifactId> <version>5</version> <scope>provided</scope> </dependency> </dependencies> </project>
You can compile you code with this jar, but of course you cannnot run
your application with it since it contains only the Java EE 5
APIs and does not contain any method bodies. If you try to
run, you would get this exception:
Exception in thread "main" java.lang.ClassFormatError:
Absent Code
attribute in method that is not native or abstract in class file
javax/mail/Session
In order to execute a Java EE 5 application, you'll still need a Java
EE 5 container, like for example the GlassFish application
server.
Ludo
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Great!
Is there any plan to post JavaEE API sources, too? It will be greatly helpful for Java EE developers.
-Wonseok
Posted by: guruwons on January 16, 2007 at 09:21 PM
-
Hi Wonseok. The sources are all available in Project GlassFish. Or do you mean something else? - eduard/o
Posted by: pelegri on January 16, 2007 at 09:37 PM
-
Please don't put the entire contents in the Description section.
Posted by: kirillcool on January 16, 2007 at 11:52 PM
-
Hello.
While I am glad that you have done this, can I observe that the JAR should be filed under javax.j2ee and given a version number of 1.5. A lot of projects have been hand coding dependencies against the existing stub poms in the main maven repository, and keeping private copies of the artifact in their own repositories.
Ignoring the rebranding and keeping the JAR under its original name lets people switch from 1.4 to 1.5 or later just by changing the version, not tracking marketing-driven name changes over time.
-Steve
Posted by: steve_l on January 17, 2007 at 12:11 AM
-
What I mean was a source bundle jar file which contains all JavaEE API sources for the published Java EE API binary. For example, JPA API has the source jar as well as binary jar in the repository,
I know there is no such publishing mechanism in current GlassFish workspace, but I hope it come in the future.
-Wonseok
Posted by: guruwons on January 17, 2007 at 03:28 AM
-
Wonseok - I see. That make sense. Ludo, what do you think? We may also want to create a better linkage with JAG's DocWeb's project (doc.java.sun.com) - eduard/o
Posted by: pelegri on January 17, 2007 at 06:15 AM
-
When do you plan to make it show up on java.net maven2 repo?
also +1 to move it to javax.javaee group, WDYT?
Posted by: danttran on January 17, 2007 at 10:03 AM
-
This is a nice move, but I echo the request to put this to a Maven 2 repository.
When this is implemented under maven2 I would like to request that this new project should be an 'umbrella' project that really includes all the sub-api's, so that there would be a separate jar for javax.servlet, javax.faces, javax.persistence and so on.
The advantage of this is a more modular structure where each part could be updated and maintained specifically, and would make it easier to include updates to specific sub-apis, like if there would sometime in the future come a new version 2.0 of the Java Server Faces API, that would be released before a final Java EE 6 comes out.
Posted by: tryggvil on January 17, 2007 at 11:31 AM
-
steve_l,
No we should move to
javax.javaee
javaee
5.0
Then we should use the maven 2 relocation feature ( http://maven.apache.org/guides/mini/guide-relocation.html ) to point anyone using javax.j2ee:j2ee:1.5 or javax.j2ee:j2ee:5.0 to the javax.javaee:javaee:5.0 poms and maven 2 will fetch correctly and give the user a note that the location has changed.
tryggvil: +10 on post to maven2 repo as maven 2 has the relocation features. However until then you can use the legacy repo by specifying the legacy layout
Posted by: stephenconnolly on January 17, 2007 at 01:28 PM
-
What is the difference between the javaee.jar in the Maven repository and the javaee.jar under lib in Glassfish ? The first one's size is ~ 650ko while the glassfish one's size is 1Mo. Does the glassfish javaee.jar contains some implementation (but I didn't find any) ?
I'm getting the ava.lang.ClassFormatError with the Maven's jar but not with the Glassfish one.
Thanks in advance
Emmanuel
Posted by: ehsavoie on January 22, 2007 at 09:16 AM
-
Whatever happened to jta in javaee-api jar??
Posted by: ameelin on March 12, 2007 at 04:22 AM
-
tryggvil: Good point to split up the javaee apis! That's exactly what I need.
Posted by: clemenso on September 26, 2007 at 08:31 AM
-
I'm not sure about this approach. Can someone explain me why classes are "malformed" ? (and how?).
We use this jar in our project and .. maybe it is nice .. until you want write test to your code. Then your test failed because it can't load this class (I try to test my custom renderer).
I try my test with javax.faces:jsf-api:1.2-b19 from public repo and it work greats. So ..maybe better will be when class simply will be do nothing and return nulls ??? instead of be malformed ?
Posted by: fl_ on December 11, 2007 at 02:22 AM
|