Transformatorhuis

May 5, 2008

Adding dependecies to Cargo Maven plugin

Filed under: Configuration — cyberroadie @ 9:40 am
Documented here (on the Cargo wiki)

This was to resolve a dependency clash between an old Sax parser implementation introduced via the CeWolf library.
CeWolf used crimson which doesn't support XML schema parser. For some reason the whole maven framework (cargo included) started to use this parser as the
default one instead of using the 'new' Xerces one, generating the following error:

javax.xml.parsers.ParserConfigurationException: Unable to validate
using XSD: Your JAXP provider[org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@ 302e67] does not
support XML Schema. Are you running on Java 1.4 or below with Apache
Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support.


So to circumvent this I had to add the 'new' dependencies to the pom.xml in two places; the normal dependency place and in the cargo-maven plugin)

(the correct version of the libraries is taken from the dependencies elsewhere in the pom.xml
<plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <version>0.3</version>
                        <configuration>
                            <wait>${cargo.wait}</wait>
                            <container>
                                <containerId>${cargo.container}</containerId>
                                <home>${cargo.container.home}</home>
                                <dependencies>
                                    <dependency>
                                        <groupId>xerces</groupId>
                                        <artifactId>xercesImpl</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>xalan</groupId>
                                        <artifactId>xalan</artifactId>
                                    </dependency>
                                </dependencies>
                                <systemProperties>
                                    <javax.xml.parsers.DocumentBuilderFactory>
                                        org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
                                    </javax.xml.parsers.DocumentBuilderFactory>
                                    <javax.xml.parsers.SAXParserFactory>
                                        org.apache.xerces.jaxp.SAXParserFactoryImpl
                                    </javax.xml.parsers.SAXParserFactory>
                                </systemProperties>
                                <zipUrlInstaller>
                                    <url>${cargo.container.url}</url>
                                    <installDir>${installDir}</installDir>
                                </zipUrlInstaller>
                            </container>
                            <configuration>
                                <home>${project.build.directory}/${cargo.container}/container</home>
                                <properties>
                                    <cargo.hostname>${cargo.host}</cargo.hostname>
                                    <cargo.servlet.port>${cargo.port}</cargo.servlet.port>
                                </properties>
                            </configuration>
                        </configuration>

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.