Conflict between Jboss BOM and Demoiselle Parent pom (?)

Asked

Viewed 129 times

1

Hello,

My Demoiselle application 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>

In doing so, I understand that the father pom of my application becomes that: http://maven-repository.com/artifact/br.gov.frameworkdemoiselle/demoiselle-servlet-parent/2.5.0/pom_effective

This guy has several dependencies listed in the dependencyManagement section. How do these dependencies relate to my application? They’re not automatically embedded in the app, huh? And when I declare a dependency like Moiselle-jpa (which is already in the father pom), I don’t need to declare version because Maven will pull the father pom version, right?

Now complicating... in the application pom 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 available biblitoecas in Jboss EAP 6.3*. So, since my application will use Jboss EAP 6.3, I don’t need to worry about knowing the exact versions of the Javaee libraries (cdi, jsf etc etc).

* GOOD FILE: http://maven.repository.redhat.com/techpreview/all/org/jboss/bom/eap6-supported-artifacts/6.3.0.GA/eap6-supported-artifacts-6.3.0.GA.pom

Now the question: some of these libraries (e.g., Weld-core) appear both in the BOM file and in the Demoiselle Parent. This is a problem? In this case, as 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 tests) from whom will Maven pull dependencies? From BOM or Demoiselle Parent? There is some kind of version conflict when trying to include libraries of different versions?

Finally, what is the need to use the Demoiselle Parent pom? It would not be better to add the necessary Demoiselle libraries to your project one by one in order to have only the necessary?

I’m sorry if the issues have become complex, but the ultimate goal is to manage my project’s dependencies in the best way possible, avoiding any risk of conflicting versions or different versions used in different contexts.

Thank you very much!

1 answer

2


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

I’ll answer the questions so you won’t be in doubt, but in the end you have the correct solution to your scenario.

On the issues:

Q: Some of these libraries (e.g., Weld-core) appear in both the BOM and Demoiselle Parent files. Is this a problem? In this case, as these Javaee dependencies are marked with Scope provided, I know that at runtime the application will use the versions available in Jboss.

A: It’s no problem to appear in both, because it’s precisely Maven’s role to resolve conflicts according to what you set up in manven. At runtime will use whatever is on the server as you already understood.

Q: But in other contexts (compilation, unit tests) from whom will Maven pull dependencies? From BOM or Demoiselle Parent? There is some kind of version conflict when trying to include libraries of different versions?

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

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

The difference is using Jboss EAP 6.3, while what is being predicted as default in the Demoiselle Parents is the Jboss AS 7.1.x of the community. In this case, what is missing is you set a PROFILE to EAP. The standard Demoiselle profile is: Jboss7 which refers to AS 7.1.x, and there are also Tomcat7 and even other older versions of Jboss and Tomcat. It also has for Glassfish and Weblogic. Simply select which one in Eclipse. That is why you will have to create a profile for EAP, then select this profile in Eclipse. Where do I think (no EAP use), that will only have the dependency that I 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 the inclusion of this profile in the Demoiselle patterns: http://tracker.frameworkdemoiselle.gov.br

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

Example in the POM

Profile no pom

Selecting by the Eclipse inserir a descrição da imagem aqui

  • Thank you so much for the detailed answer! I guess I just didn’t quite understand that "profile" is this... profile of Maven isn’t, is it? Would it be an "Eclipse profile"? How do I search for more about this profile? Thank you!

  • 1

    The profile is a Maven configuration. See in this file the Demoiselle default profiles: https://github.com/demoiselle/framework/blob/master/parent/servlet/pom.xml In your case you can make the configuration in the project’s POM.XML. In order for this to work in Eclipse, if you are not using the pattern (in the case of Demoiselle is Jboss AS 7), you need to select the profile. In the Eclipse menu (selecting the project) is: Maven -> Select Maven Profile...

  • Hi! I couldn’t figure out how to activate the profile just by editing my pom. Is there any way? I saw that I could do with Settings.xml or passing the -P in the mvn command. But I couldn’t find the same pom.

  • 1

    When include in POM should appear as an opation in Eclipse: Ctrl+Alt+P. I will edit the answer to exemplify.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.