How to download J2EE API (javaee.jar) from Maven
Published: March 17, 2010 , Updated: June 21, 2010 , Author: mkyong
The J2EE API library (javaee.jar or javaee-api.jar) is not available in the default Maven repository (http://repo1.maven.org/maven2/). You need to download it from Java.Net repository.
1. Add Java.Net reporitory
<repository> <id>Java.Net</id> <url>http://download.java.net/maven/2/</url> </repository>
2. Add the J2EE dependency
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency>
Full pom.xml example
<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>com.mkyong</groupId> <artifactId>SpringWebExample</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>SpringWebExample Maven Webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>Java.Net</id> <url>http://download.java.net/maven/2/</url> </repository> </repositories> <dependencies> <!-- Javaee API --> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency> </dependencies> <build> <finalName>SpringWebExample</finalName> </build> </project>
This above java.net javaee.jar is only contains the J2ee APIs and does not contain any method bodies. It’s fine for compilation, but not for run or deploy your application, because it will caused ” Absent Code attribute in method that is not native or abstract in class” error. The best practice is always get the original full version of javaee.jar from the http://java.sun.com/javaee/.
Reference
Any Java questions or problems? please post at this JavaNullPointer.com forum, see you there ~
[ Read More ] You can find more similar articles at Maven Tutorials
[...] How to download javaee.jar from Maven This article was posted in JSF2 category. Oracle Magazine – Free Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for Java's developers and DBAs, and more. [...]
[...] </dependencies> The downloaded javaee.jar is not contains any method bodies, see this “how to get javaee.jar from Maven” article for detail. VN:F [1.9.1_1087]please wait…Rating: 0.0/10 (0 votes [...]
[...] </dependencies> The downloaded javaee.jar is not contains any method bodies, see this “how to get javaee.jar from Maven” article for detail. VN:F [1.9.1_1087]please wait…Rating: 0.0/10 (0 votes [...]
[...] J2EE API (javaee.jar) [...]