FYI, there is a bug in Maven's exclusion muck, where excludes thats should be scoped to a module are promoted to global.

I'm not sure of the exact details, but I have been bitten by this one before... when excluding a old version of commons-logging, since JCL freaks out if there are more than one version on the classpath, but that ended up excluded commons-logging from everything. Only fix I had in that case was to exclude the old commons-logging and then use the new artifact names commons-logging-api and commons-logging- adapters to pick up the versions that I really wanted. Thats probably not an option here, but just for explanation.

As for why you still see 1.0.1, cant really say... but could well be more artifact select bugs in Maven. There seem to be quite a few these days...

--jason


On Feb 6, 2007, at 3:30 AM, Jacek Laskowski wrote:

Hi,

I'm not sure why I've been doing it, but anyhow I'd decided to do it
and it eventually took me longer than I'd anticipated. As you might've
guessed, I couldn't sort it out myself.

The problem is with how the transitive dependency in M2 works *and*
how I understand it. After I'd built OpenEJB3, I took a look at m2
local repository and noticed a couple of older libraries that should
not have been there. We don't need them so why M2 downloads them?

Just an example - itests/openejb-itests-beans. It needs
geronimo-jms_1.1_spec 1.1, but somehow 1.0.1 is downloaded, too. What
I did was to specify the exclusion in the main pom.xml:

         <exclusion>
           <groupId>org.apache.geronimo.specs</groupId>
           <artifactId>geronimo-jms_1.1_spec</artifactId>
         </exclusion>

as part of org.apache.openjpa:openjpa-persistence-jdbc. It ended up
with a failure because of missing JMS classes. I said, well, I need to
specify the dependency (the one I had excluded earlier) in the
openejb-itests-beans. And so did I.

   <dependency>
     <groupId>org.apache.geronimo.specs</groupId>
     <artifactId>geronimo-jms_1.1_spec</artifactId>
   </dependency>

Run mvn -N install in the main directory of OpenEJB3, and run mvn
clean install to see how it'd go. It failed. Why? It seems that the
parent exclusion was of greater importance to M2 and although I had
declared the deps in openejb-itests-beans, it didn't help, either.

So, I had to remove the exclusion and now M2 downloads two versions of
geronimo-jms_1.1_spec - 1.1 and 1.0.1. Why?

$ mvn  clean install
[INFO] Scanning for projects...
[INFO] ---------------------------------------------------------------------- ------
[INFO] Building OpenEJB :: iTests Beans
[INFO]    task-segment: [clean, install]
[INFO] ---------------------------------------------------------------------- ------
[INFO] [clean:clean]
[INFO] Deleting directory c:\oss\openejb3\itests\openejb-itests- beans\target
[INFO] Deleting directory
c:\oss\openejb3\itests\openejb-itests-beans\target\classes
[INFO] Deleting directory
c:\oss\openejb3\itests\openejb-itests-beans\target\test-classes
[INFO] Deleting directory
c:\oss\openejb3\itests\openejb-itests-beans\target\site
[INFO] [tools:require-java-version {execution: default}]
[INFO] [tools:copy-legal-files {execution: install-legal-files}]
[INFO] Created dir:
c:\oss\openejb3\itests\openejb-itests-beans\target\classes\META-INF
[INFO] Copying 3 files to
c:\oss\openejb3\itests\openejb-itests-beans\target\classes\META-INF
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading: http://people.apache.org/repo/m2-incubating-repository/ org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.0.1/geronimo- jms_1.1_spec-1.0.1.pom
[WARNING] Unable to get resource from repository
apache-incubating-repository
(http://people.apache.org/repo/m2-incubating-repository)
Downloading: http://repo1.maven.org/maven2/org/apache/geronimo/ specs/geronimo-jms_1.1_spec/1.0.1/geronimo-jms_1.1_spec-1.0.1.pom
1K downloaded
Downloading: http://people.apache.org/repo/m2-incubating-repository/ org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1/geronimo- jms_1.1_spec-1.1.pom
[WARNING] Unable to get resource from repository
apache-incubating-repository
(http://people.apache.org/repo/m2-incubating-repository)
Downloading: http://repo1.maven.org/maven2/org/apache/geronimo/ specs/geronimo-jms_1.1_spec/1.1/geronimo-jms_1.1_spec-1.1.pom
1K downloaded
Downloading: http://people.apache.org/repo/m2-incubating-repository/ org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1/geronimo- jms_1.1_spec-1.1.jar
[WARNING] Unable to get resource from repository
apache-incubating-repository
(http://people.apache.org/repo/m2-incubating-repository)
Downloading: http://repo1.maven.org/maven2/org/apache/geronimo/ specs/geronimo-jms_1.1_spec/1.1/geronimo-jms_1.1_spec-1.1.jar
31K downloaded
[INFO] [compiler:compile]
Compiling 139 source files to
c:\oss\openejb3\itests\openejb-itests-beans\target\classes
[INFO] [resources:testResources]

What's more annoying is that I tried to use some dependency display
tools, like mvn tools:show-dependencies -Dverbose=true, but it showed
noone needed the 1.0.1 version. Why?

[INFO] [tools:show-dependencies]
[INFO] org.apache.openejb:openejb-itests-beans:jar {
version=3.0-incubating-SNAPSHOT, scope=null }
[INFO]     junit:junit:jar { version=4.1, scope=compile }
[INFO]     org.apache.geronimo.specs:geronimo-ejb_3.0_spec:jar {
version=1.0, scope=compile }
[INFO]     org.apache.openjpa:openjpa-persistence-jdbc:jar {
version=0.9.6-incubating, scope=compile }
[INFO]         org.apache.openjpa:openjpa-jdbc-5:jar {
version=0.9.6-incubating, scope=compile }
[INFO]             org.apache.openjpa:openjpa-jdbc:jar {
version=0.9.6-incubating, scope=compile }
[INFO] hsqldb:hsqldb:jar { version=1.8.0.7, scope=compile }
[INFO]                 org.apache.openjpa:openjpa-kernel:jar {
version=0.9.6-incubating, scope=compile }
[INFO]                     org.apache.openjpa:openjpa-lib:jar {
version=0.9.6-incubating, scope=compile }
[INFO]                         net.sourceforge.serp:serp:jar {
version=1.11.0, scope=compile }
[INFO]
commons-collections:commons-collections:jar { version=3.2,
scope=compile }
[INFO]                         commons-logging:commons-logging:jar {
version=1.0.4, scope=compile }
[INFO] ant:ant:jar { version=1.6.5, scope=compile }
[INFO]                         commons-lang:commons-lang:jar {
version=2.1, scope=compile }
[INFO] log4j:log4j:jar { version=1.2.12, scope=compile }
[INFO]                     commons-pool:commons-pool:jar {
version=1.3, scope=compile }
[INFO]         org.apache.openjpa:openjpa-persistence:jar {
version=0.9.6-incubating, scope=compile }
[INFO]             javax.persistence:persistence-api:jar {
version=1.0, scope=compile }
[INFO]             org.apache.openjpa:openjpa-kernel-5:jar {
version=0.9.6-incubating, scope=compile }
[INFO]     xerces:xercesImpl:jar { version=2.6.2, scope=compile }
[INFO]     org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar {
version=1.0, scope=compile }
[INFO]     org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar
{ version=1.0, scope=compile }
[INFO]     org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar {
version=1.1, scope=compile }
[INFO]     xerces:xmlParserAPIs:jar { version=2.2.1, scope=compile }

I'm loosing my patience with it. I'd better go doing something easier.
Anyone willing to lend me a helping hand?

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl

Reply via email to