Conflict between JBoss BOM and Demoiselle parent pom (?)

1

Hello,

My application Demoiselle declares the following to be a Demoiselle application:

<properties>
    <demoiselle.framework.version>2.5.0-RC1</demoiselle.framework.version>
</properties>

<parent>
    <groupId>br.gov.frameworkdemoiselle</groupId>
    <artifactId>demoiselle-servlet-parent</artifactId>
    <version>2.5.0-RC1</version>
</parent>

While doing this, I understand that the parent of my application becomes this: link

On this face there are several dependencies listed in the dependencyManagement section. What is the relationship of these dependencies to my application? They are not automatically embedded into the application, neh? And when I declare a dependency like demoiselle-jpa (which is already in the parent pom), I do not need to declare version because Maven will pull the parent pom version, right?

Now complicating ... in the pom of the application we also have the following:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.bom</groupId>
            <artifactId>eap6-supported-artifacts</artifactId>
            <version>6.3.0.GA</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

This refers to a Red Hat BOM file that lists all scripts available in JBoss EAP 6.3 *. So, since my application will use JBoss EAP 6.3, I do not have to worry about knowing the exact versions of the JavaEE libraries (cdi, jsf etc etc).

* BOM file: link

Now the question: Some of these libraries (eg, weld-core) appear in both the BOM file and the Demoiselle parent. Is this a problem? In this case, because these JavaEE dependencies are marked with scope provided, I know that at runtime the application will use the versions available in JBoss. But in other contexts (compilation, unit testing) of whom maven will pull the dependencies? BOM or Demoiselle parent? Is there any version conflict when trying to include libraries of different versions?

Finally, what is the need to use Demoiselle parent pom? Would not it be better to add the necessary Demoiselle libraries to your project one by one, so you only have what it takes?

Sorry if the issues were complex, but the ultimate ultimate goal is to perform dependency management of my project as best as possible, avoiding any risk of version conflicts or different versions used in different contexts.

Thank you!

    
asked by anonymous 26.08.2015 / 14:47

1 answer

2

Sorry for the delay in responding, but I was busy these days.

I will answer the questions so that you do not get into doubt, but in the end you have the right solution for your scenario.

Regarding the issues:

Q: Some of these libraries (eg, weld-core) appear in both the BOM file and the Demoiselle parent. This is a problem? In this case, since these JavaEE dependencies are marked with scope provided, I know that at runtime the application will use the versions available in JBoss.

A: It is not a problem to appear in both, as it is precisely the role of Maven to resolve conflicts according to what you configure yourself in manven. At runtime you will use whatever is on the server as you have already understood.

Q: But in other contexts (compilation, unit testing) of who maven will pull the dependencies? BOM or Demoiselle parent? Is there any version conflict when trying to include libraries of different versions?

A: It depends on the context, in the compilation (for being provided) not influence, but in the unit tests will be that informed in the POM.XML that in turn will be in the local repository. The libraries in the Demoiselle Parent are defined to help precisely not have so many things repeated in various applications and that may be a standard, but any dependency can be included or excluded through POM.XML according to the will of the developer, just configure in the file. Using different between provided and what is in the unit test, can (not sure of the yes or the not) be problem, because it does not guarantee that what was tested will perform exactly the same way on the server.

Well, as said the solution to your case should be this:

The difference is in using JBoss EAP 6.3, while what is being provided by default in the Demoiselle Parents is JBoss AS 7.1.x in the community. In this case, what is missing is you define a PROFILE for EAP. The default profile of Demoiselle is: JBoss7 which refers to AS 7.1.x, and there are also Tomcat7 and even older versions of Jboss and Tomcat. It also has for Glassfish and WebLogic. Eclipse would only select which one. That's why you'll have to create a profile for EAP, then select that profile in Eclipse. Where do I find (I do not use EAP), which will only have dependency that quoted:

    <dependency>
        <groupId>org.jboss.bom</groupId>
        <artifactId>eap6-supported-artifacts</artifactId>
        <version>6.3.0.GA</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

You can also suggest adding this profile to the Demoiselle standards: link

And you have nothing to apologize for, because every questioning always helps to improve the project.

Example in POM

SelectingbyEclipse

    
28.08.2015 / 19:30