Affecting dependencies through profiles is generally a very bad idea! One theme with Maven (and any tool using a Maven repo) is deterministic builds. If active profiles change the dependency tree this is not true.
/Anders On Wed, May 9, 2012 at 6:36 PM, Gay David (Annecy) <d...@axway.com> wrote: > Hi all, > > > > I have a little problem with the dependencies management and profile in > Maven. > > Have a look on the attached project. > > > > My goal is to be able to set some dependency version per profile. > > > > The problem is that when I do a dependency tree, it won’t do what I want. > > For example if I do mvn dependency:tree in module 2, I have : > > > > mvn dependency:tree > > [INFO] Scanning for projects... > > [INFO] > > [INFO] > ------------------------------------------------------------------------ > > [INFO] Building module2 0.0.1-SNAPSHOT > > [INFO] > ------------------------------------------------------------------------ > > [INFO] > > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ module2 --- > > [INFO] my.company:module2:pom:0.0.1-SNAPSHOT > > [INFO] \- my.company:module1:pom:0.0.1-SNAPSHOT:compile > > [INFO] \- commons-io:commons-io:jar:2.0:compile > > > > Which is ok, common-io version is the wanted one : 2.0 > > > > But if I do a mvn dependency:tree –Pdev, I have : > > > > [INFO] Scanning for projects... > > [INFO] > > [INFO] > ------------------------------------------------------------------------ > > [INFO] Building module2 0.0.1-SNAPSHOT > > [INFO] > ------------------------------------------------------------------------ > > [INFO] > > [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ module2 --- > > [INFO] my.company:module2:pom:0.0.1-SNAPSHOT > > [INFO] \- my.company:module1:pom:0.0.1-SNAPSHOT:compile > > [INFO] \- commons-io:commons-io:jar:2.1:compile (version managed from > 2.0) > > > > Which is not what I expected : I understand that the V2.0 will be taken for > commons-io > > > > Did I misunderstand profile and/or dependencies management ? > > Or is there a bug womewhere ? > > Or maybe what I try to do is just crazy and not at all recommended ? > > Because, my little example is just to demonstrate the effect, but in reality > I would like to be able to switch easily from release to snapshot for > development purpose, just by setting a profile. > > > > BTW, the Maven version I use : > > mvn --version > > Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) > > Maven home: C:\Java\apache-maven-3.0.3\bin\.. > > Java version: 1.6.0_26, vendor: Sun Microsystems Inc. > > Java home: C:\Java\jdk1.6.0_26\jre > > Default locale: fr_FR, platform encoding: Cp1252 > > OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows" > > > > > > Thanks for any help or tips > > > > WBR // David > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org