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).
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!
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!
– Leonardo Leite
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...
– Saito
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.
– Leonardo Leite
When include in POM should appear as an opation in Eclipse: Ctrl+Alt+P. I will edit the answer to exemplify.
– Saito