Is there a single maven dependency containing whole Java EE 5 spec API. Just like
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency>
for Java EE 6.
I'm using JBoss 5 and want to add single (or several) dependency as provided scope and be sure that I have everyting that is available in JBoss.
Maybe some kind of archetype exist for JBoss 5.x.x deployed project?
Based on maven central I think you need the following:
<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<version>5</version>
</dependency>
Related
This might be a silly question. But I have a doubt, why do we need the following dependency to run EJB in Wildfly?
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
Do we have something similar which is customized for Wildfly only?
Actually, you just need this maven dependency so your code can compile successfully during maven compile phase. For example, EJB annotations such as #Stateless are provided by it.
I use to declare this maven dependency instead for my Java EE 7 projects, so the whole bunch of JEE specs are available :
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
Finally this maven dependency has to be declared with "provided" scope as you don't need it within your package. Indeed it is already provided by Wildfly, as described in this documentation: Implicit module dependencies for deployments
I followed some tutorials on EJB 3.1 and those were using the following dependency for EJB-API.
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
</dependency>
My problem is, this is only for jboss or can I used this in any other application servers. If not why there are dependency like these which are not independent from the application server it gets deployed. And also I found this reference for ejb 3.1 api. Therefore please elaborate what are these and why those are there.
You can use it on any server you like. Just remember to put add the <scope>provided</scope> tag to the dependency like this:
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
The provided scope means that this dependency is only used to compile your code and not included in the resulting EAR/WAR/JAR. In the runtime this dependency is provided by your application server (JBoss, Websphere, whatever). If you omit the scope specification section very bad things may happen.
Here you go. This is from EJB specs.
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>javax.ejb-api</artifactId>
<version>3.2</version>
</dependency>
Hope this helps.
Do you know guys the differences between the following artifacts?
Which one should I use in which circumstances?
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.1_spec</artifactId>
<scope>provided</scope>
</dependency>
and
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
Or more specifically I am planning to replace the 1st dependency with 2nd one for my webapp which will deploy to both JBoss 7.1.1 and Glassfish 3.1.2.1. Should I expect any side effects?
The first one is provided by jboss.org and the second one is Developed through the Java Community Process under JSR - 314.You can replace 1st dependency with 2nd one. There is no side effects.
I have the follwing dependencies in my POM. I am trying to add the CDI facet in IntelliJ IDEA 11 because I thought I would get an option for creating the beans.xml file without manually having to write it, just as you do with persistence.xml etc. However even though I have the dependencies it says Weld is missing, but why do I need to download these when I have everything I need in the POM?
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
On a JBoss stack, I usually use that dependency:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
(Requires JBoss Repo)
Have a look at that configuration here, which I used for a plain Java EE 6 stack (on a JBoss AS 6)
I've never had weld on the classpath. Simply the cdi-api and the beans.xml and it finds the facet just fine. If you're worried about having to manually create the beans.xml, create a template for it and be done.
I want to run the servlet testing example available here using maven. Javaee web api should be declared as provided:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.7</version>
<scope>test</scope>
</dependency>
However, one of the tests in the example throws ServletException. NetBeans complains that java ee api is missing on project classpath. How does one solve this issue?
EDIT
It is not a NetBeans issue, it is a maven issue.
Now this is the most debilitating issue I have ever faced in my Java days. And it is followed by the most ridiculous workaround I have ever seen, ever:
<dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
Yes, permute the declaration of dependencies in the pom.xml (see here for "why") and make javaee-web-api last.
It means that maven (or netbeans...I haven't used netbeans in 10 years), couldn't download or find that artifact in the local repository.
The scope provided means: I need the jar to compile my source code, but don't bundle the jar in the final package.