Archive for the ‘Grails’ Category

Maven and Grails

January 27th, 2014 No comments

I needed to push the generated Grails war into a maven repository. There are several ways to do this. I used the grails create-pom command (2.3.1) to create a pom.xml file. This seemed most logical to me.

Then I tried to do a mvn clean install from there to have it put in my local repo. This failed hard.

Fatal error forking Grails JVM: java.lang.reflect.InvocationTargetException

I changed the grails-maven-plugin to not fork to get a less cryptic description of the problem.

		<!-- Whether for Fork a JVM to run Grails commands -->

This got me the actual error description:

Unable to start Grails: java.lang.reflect.InvocationTargetException: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found

The dreaded xerces error.

I apparently had some unwanted dependencies. I executed a mvn dependency:tree to see if any of these were in use.
DynamicJasper seemed to be the culprit here. It contained a runtime dependency on xml-apis.

[INFO] +-
[INFO] |  \- net.sf.jasperreports:jasperreports:jar:4.1.1:runtime
[INFO] |     +- commons-digester:commons-digester:jar:1.7:runtime
[INFO] |     +- com.lowagie:itext:jar:2.1.7:runtime
[INFO] |     |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:runtime
[INFO] |     |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:runtime
[INFO] |     |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:runtime
[INFO] |     +- jfree:jcommon:jar:1.0.15:runtime
[INFO] |     +- jfree:jfreechart:jar:1.0.12:runtime
[INFO] |     +- xml-apis:xml-apis:jar:1.3.02:runtime
[INFO] |     +- eclipse:jdtcore:jar:3.1.0:runtime
[INFO] |     +- org.codehaus.castor:castor:jar:1.2:runtime
[INFO] |     \- org.apache.poi:poi-ooxml:jar:3.6:runtime
[INFO] |        +- org.apache.poi:poi:jar:3.6:runtime
[INFO] |        \- org.apache.poi:poi-ooxml-schemas:jar:3.6:runtime
[INFO] |           +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:runtime
[INFO] |           \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0:runtime

I then dropped the dependency in my pom.xml:


After this I could install/deploy the artifact.

Categories: Grails Tags: