Java EE 5 APIs now in a Maven repository...
Posted by ludo on January 16, 2007 at 11:58 PM EST
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;In a Maven project defined by this pom file: (notice the scope value which is 'provided')
import javax.persistence.Entity;
import javax.mail.Session;
public class Foo {
public static void main(String[] args) {
Queue queue = null;
Session.getInstance(null);
}
}
?xml version="1.0" encoding="UTF-8"?>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:
<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>
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
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- ludo's blog
- 17840 reads





