How to download J2EE API (javaee.jar) from Maven
Published: March 17, 2010 , Updated: February 13, 2012 , Author: mkyong
This below java.net javaee.jar solution is only contains the J2ee APIs, it 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” or other method not found errors. Due to policy, it’s not possible to include this javaee.jar in any public Maven repository.
The best practice is always get the original full version of javaee.jar from the http://www.oracle.com/technetwork/java/javaee/overview/index.html, and include it into your project manually.
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>
Reference
Note : 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) [...]