In our project, we have separate modules for REST layer, EJB layer and domain (Entity) layer.
Here is the dependency on our REST layer:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jettison-provider</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
</dependency>
<!-- Resteasy Server Cache -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cache-core</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
</dependency>
Q1: Is there a single dependency of org.jboss.resteasy
that provides all of these? Any possibility for simplification? should all these dependencies be explicitly declared? If not, what does RestEasy provides some by default? In fact, I use JBoss AS 6. so these dependencies are only for compile time. Their scope is provided
anyway.
Same holds for our Domain layer:
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
Q2: why are these declared explicitly in our pom.xml? shouldn't one dependency on hibernate provides defaults for others.
Q3 Is the following an effective way of refactoring (using Jboss bom) ? Have one dependency in parent pom.xml and each modules just inherit from parent. In this way, child pom.xml is simplified and short. what is the downside of this? will I get all the dependencies I provided explicitly in each of REST and domain layer above.
<dependency>
<groupId>org.jboss.bom.eap</groupId>
<artifactId>jboss-javaee-6.0-with-resteasy</artifactId>
<version>${jboss.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>