I'm assuming that you have your preferred version of xerces listed in a
<dependencyManagement> section of your root pom.xml. That's a good thing,
but it's not a panacea because of Maven 2's oddball rules about what version
wins, based on some sort of "distance from the invoker" rule. I think
there's a JIRA entry asking for better behavior there, and I haven't checked
on it lately so I don't know the status.

I've dealt with a similar issue by putting an explicit dependency on the
preferred artifact version into the pom.xml of the project that generates
the artifact into which the subsidiary artifact will be packaged. That's an
ear, in my case. That works because such dependencies always win the version
competition, but it is a bit of a hack.

-- Bryan

-----Original Message-----
From: Chris Searle [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 03, 2007 2:04 AM
To: Maven Users List
Subject: Re: XML parser versions

> I suggest grepping your local repository for 1.2.3. My guess would  
> be that
> you'll find a reference to it in a pom.xml file somewhere in there.

slippen:~/.m2/repository chris$ grep -r -l "1.2.3" . | grep pom$
./commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.pom
./xerces/xerces/1.2.3/xerces-1.2.3.pom

So - it is present in xerces itself and commons-jxpath.

So - I have added the following again:

     <dependency>
       <groupId>commons-jxpath</groupId>
       <artifactId>commons-jxpath</artifactId>
       <version>1.2</version>
       <exclusions>
         <exclusion>
           <groupId>xerces</groupId>
           <artifactId>xerces</artifactId>
         </exclusion>
       </exclusions>
     </dependency>

Ran a mvn clean, then a site then a test.

site still shows xerces xerces 1.2.3 required under Project  
Transitive Dependencies

test still fails due to the wrong parser being used



>
> -----Original Message-----
> From: Chris Searle [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 02, 2007 5:55 AM
> To: [email protected]
> Subject: XML parser versions
>
> OK. A little confused here. I have three maven projects - all were
> running just fine. All are spring based - and I wanted to add some
> simple aspect programming to one of them. So - I changed the spring
> config file to start like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xmlns:aop="http://www.springframework.org/schema/aop";
>         xmlns:tx="http://www.springframework.org/schema/tx";
>         xsi:schemaLocation="http://www.springframework.org/schema/
> beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>                             http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
>                             http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>
>       <aop:spring-configured/>
>
>
> Now - for this to be parseable you need a recent parser - so - I
> added the following to the pom:
>
>     <dependency>
>        <groupId>xerces</groupId>
>        <artifactId>xercesImpl</artifactId>
>        <version>2.8.1</version>
>      </dependency>
>
> This project works just fine. mvn test completes, mvn install works.
> All is well and good. Even the spring aop stuff works fine - using
> the aspectjweaver.jar :)
>
>
> Projects 2 and 3 depend on project 1. Both of these have the exact
> same start to their spring XML minus the <aop:spring-configured> line
> since they do not directly have aop (they both use the spring config
> of project1 for that part - loaded from the classpath). Both projects
> 2 and 3 have the same xerces dependency in their poms.
>
> mvn test and mvn install work just fine on project 2. But project 3
> fails. It gives:
>
> testGetActiveMembersReport(net.chrissearle.export.TestExportService)
> Time elapsed: 5.424 sec  <<< ERROR!
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
>  L
> ine 9 in XML document from class path resource [project1.xml] is
> invalid; nested exception is org.xml.sax.SAXParseException: cvc-
> complex-type.2.4.c: The matching wildcard is strict, but no
> declaration can be found for element 'aop:spring-configured'.
>
> Now - this is apparently due to parser version.
>
> mvn dependency:build-classpath shows only xerces 2.8.1. But - mvn
> site builds a site page where the dependencies show:
>
> For compile:
>
> xerces xercesImpl 2.8.1 - jar
>
> but - for Project Transitive Dependencies
>
> xerces xerces 1.2.3 - jar
>
> However - the Project Dependency Graph only lists
> xerces:xercesImpl:jar (the direct dependency) - not the
> xerces:xerces:jar.
>
> I just can't figure out what is pulling in the older xerces - and I
> need to get it into an exclusion somehow. Any hints on how to find
> out what is pulling it in?
>
> Chris Searle
> [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Chris Searle
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to