If you use full Java EE container such as JBoss or Glassfish — and you (are fortunate enough) to use Maven. Here’s a simple way to pull all Java EE dependencies into your classpath. Add following dependency into your pom.xml:
javax javaee-api 6.0 provided
Notice the scope is set to provided, this is important because on runtime all those classes will be provided by your container.
Also the above is for Java EE 6. You can use following for Java EE 7:
javax javaee-api 7.0 provided