Ralph Goers wrote:
Reinhard Poetz wrote:
Ralph Goers wrote:
Is the cocoon build really trying to rely on transitive dependency verions? Very bad idea. Versions of every dependency cocoon uses directly or indirectly should be specified in the managedDependencies.

The problem is that the groupId of the Avalon framework changed and that's the root of all evil in this case. We ever never need a dependency on Avalon 4.1.3 but how to express this in the managedDependencies section?

The only chance for us is configuring "exclusions" but first you have to figure out that you have to do it at all (here the dependency module comes into play).

I have also experienced very strange behaviour of the dependency resultion mechanism e.g. I exclude avalon-framework from being pulled in by commons-logging but then, when I use commons-beanutils, which pulls in commons-logging, the avalon-framework dependency is used again.

TBH, I have no idea why the dependency resolution is still buggy after such a long time after the first final Maven 2 release :-/

Can you point me at the poms I should look at to see this?

If you refer to the commons-beanutils/commons-logging problem, here is a stripped down variant of a custom project of ours that reproduced the problem:

PARENT:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>

  <groupId>com.example</groupId>
  <artifactId>test-parent</artifactId>
  <version>1-SNAPSHOT</version>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.cocoon</groupId>
        <artifactId>cocoon-core</artifactId>
        <version>2.2.0-RC2</version>
      </dependency>
      <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.0-BETA</version>
      </dependency>
      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <version>1.1</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <profiles>
    <profile>
      <id>use-snapshots</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.0-alpha-5-SNAPSHOT</version>
          </plugin>
        </plugins>
      </build>
      <repositories>
        <repository>
          <id>apache.org</id>
          <name>Maven Snapshots</name>
          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>codehaus.org</id>
          <name>CodeHaus Snapshots</name>
          <url>http://snapshots.repository.codehaus.org</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>apache.org</id>
          <name>Maven Plugin Snapshots</name>
          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
        <pluginRepository>
          <id>codehaus.org</id>
          <name>Maven Plugin Snapshots (Codehaus)</name>
          <url>http://snapshots.repository.codehaus.org</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</project>

CHILD:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>

  <parent>
    <groupId>com.example</groupId>
    <artifactId>test-parent</artifactId>
    <version>1-SNAPSHOT</version>
  </parent>
  <artifactId>test-child</artifactId>
  <version>1.0.0-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>org.apache.cocoon</groupId>
      <artifactId>cocoon-core</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
    </dependency>
  </dependencies>
  <profiles>
    <profile>
      <id>foo</id>
    </profile>
  </profiles>
</project>


Run "mvn dependency:list -P use-snapshots" and "mvn dependency:list -P use-snapshots,foo" for the child project and compare the results with regard to avalon-framework.


--
Reinhard Pötz                            Managing Director, {Indoqa} GmbH
                          http://www.indoqa.com/en/people/reinhard.poetz/

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair        [EMAIL PROTECTED]
_________________________________________________________________________

Reply via email to