Showing posts with label grumpy. Show all posts
Showing posts with label grumpy. Show all posts

Friday, April 19, 2013

cdk and grails - why don't get they along. This time using maven for dependency management...

...

Recently I posted about grails2 and the CDK using the BuildConfig.groovy approach.

Now it's only fair that I show the maven approach as alternative. It's aint pretty...

But it works and allows you to build grails 2.1 project with the CDK. Now i just need to integrate scala into the mix...


<?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>
    <groupId>edu.ucdavis.fiehnlab.cts</groupId>
    <artifactId>cts</artifactId>
    <packaging>grails-app</packaging>
    <version>2.0-beta-2</version>
    <name>cts</name>
    <description>2.0-beta-2</description>

    <parent>
        <artifactId>web</artifactId>
        <groupId>edu.ucdavis.fiehnlab.cts.web</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-dependencies</artifactId>
            <version>${grails.version}</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-test</artifactId>
            <version>${grails.version}</version>
            <type>pom</type>
        </dependency>


        <dependency>
            <groupId>org.grails</groupId>
            <artifactId>grails-plugin-testing</artifactId>
            <version>${grails.version}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>net.sf.jni-inchi</groupId>
            <artifactId>jni-inchi</artifactId>
            <version>${jni.inchi.version}</version>
        </dependency>

        <dependency>

            <groupId>org.openscience.cdk</groupId>
            <artifactId>cdk-inchi</artifactId>
            <version>${cdk.version}</version>

            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>java3d</groupId>
                    <artifactId>vecmath</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xmlpull</groupId>
                    <artifactId>xmlpull</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>cml</groupId>
                    <artifactId>cmlxom</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xom</groupId>
                    <artifactId>xom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jdom</groupId>
                    <artifactId>jdom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>jama</groupId>
                    <artifactId>jama</artifactId>
                </exclusion>

            </exclusions>
        </dependency>

        <dependency>

            <groupId>org.openscience.cdk</groupId>
            <artifactId>cdk-fingerprint</artifactId>
            <version>${cdk.version}</version>

            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>java3d</groupId>
                    <artifactId>vecmath</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xmlpull</groupId>
                    <artifactId>xmlpull</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>cml</groupId>
                    <artifactId>cmlxom</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xom</groupId>
                    <artifactId>xom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jdom</groupId>
                    <artifactId>jdom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>jama</groupId>
                    <artifactId>jama</artifactId>
                </exclusion>

            </exclusions>
        </dependency>
        <dependency>

            <groupId>org.openscience.cdk</groupId>
            <artifactId>cdk-renderawt</artifactId>
            <version>${cdk.version}</version>

            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>java3d</groupId>
                    <artifactId>vecmath</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xmlpull</groupId>
                    <artifactId>xmlpull</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>cml</groupId>
                    <artifactId>cmlxom</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xom</groupId>
                    <artifactId>xom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jdom</groupId>
                    <artifactId>jdom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>jama</groupId>
                    <artifactId>jama</artifactId>
                </exclusion>

            </exclusions>
        </dependency>


        <dependency>

            <groupId>org.openscience.cdk</groupId>
            <artifactId>cdk-render</artifactId>
            <version>${cdk.version}</version>

            <scope>runtime</scope>


            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>java3d</groupId>
                    <artifactId>vecmath</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xmlpull</groupId>
                    <artifactId>xmlpull</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>cml</groupId>
                    <artifactId>cmlxom</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xom</groupId>
                    <artifactId>xom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jdom</groupId>
                    <artifactId>jdom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>jama</groupId>
                    <artifactId>jama</artifactId>
                </exclusion>

            </exclusions>
        </dependency>


        <dependency>
            <groupId>org.codehaus.groovy.modules.http-builder</groupId>
            <artifactId>http-builder</artifactId>
            <version>0.5.2</version>
            <scope>runtime</scope>

            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xmlParserAPIs</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>

                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>8.2-504.jdbc3</version>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>cache</artifactId>
            <version>1.0.1</version>
            <type>zip</type>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>jquery-ui</artifactId>
            <version>1.8.24</version>
            <type>zip</type>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>jquery</artifactId>
            <version>1.8.3</version>
            <type>zip</type>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>export</artifactId>
            <version>1.5</version>
            <type>zip</type>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>resources</artifactId>
            <version>1.1.6</version>
            <type>zip</type>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>jquery-ui-extensions</artifactId>
            <version>0.5.8</version>
            <type>zip</type>
        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>hibernate</artifactId>
            <version>${grails.version}</version>
            <type>zip</type>

        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>spock</artifactId>
            <version>0.6</version>
            <type>zip</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-grails-support</artifactId>
            <version>0.6-groovy-1.8</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>functional-test</artifactId>
            <version>1.2.7</version>
            <type>zip</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>webxml</artifactId>
            <version>1.4.1</version>
            <type>zip</type>
        </dependency>

        <dependency>
            <groupId>org.grails.plugins</groupId>
            <artifactId>tomcat</artifactId>
            <version>2.1.0</version>
            <type>zip</type>
            <scope>runime</scope>
        </dependency>


    </dependencies>

    <build>
        <pluginManagement/>

        <plugins>
            <!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>surefire-it</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>plugins</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.grails</groupId>
                <artifactId>grails-maven-plugin</artifactId>
                <version>${grails.version}</version>
                <configuration>
                    <!-- Whether for Fork a JVM to run Grails commands -->
                    <fork>true</fork>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>grails</id>
            <name>grails</name>
            <url>http://repo.grails.org/grails/core</url>
        </repository>
        <repository>
            <id>grails-plugins</id>
            <name>grails-plugins</name>
            <url>http://repo.grails.org/grails/plugins</url>
        </repository>

        <repository>
            <id>ambit-public</id>
            <name>ambit-public</name>
            <url>http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/public/</url>
        </repository>


        <repository>
            <id>ambit-thirdparty</id>
            <name>ambit-thirdparty</name>
            <url>http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/thirdparty/</url>
        </repository>


        <repository>
            <id>codehaus</id>
            <name>codehaus</name>
            <url>http://snapshots.repository.codehaus.org</url>
        </repository>


    </repositories>
</project>


Thursday, March 14, 2013

cdk and grails, why don't they get along...

so apperently the cdk depends on some xml libaries, which causes us all kind of error messages like this in grails:


| Loading Grails 2.1.0
| Configuring classpath
| Error Error executing script Help: loader constraint violation: when resolving overridden method "org.apache.tools.ant.helper.ProjectHelper2$RootHandler.setDocumentLocator(Lorg/xml/sax/Locator;)V" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/apache/tools/ant/helper/ProjectHelper2$RootHandler, and its superclass loader (instance of ), have different Class objects for the type org/xml/sax/Locator used in the signature (Use --stacktrace to see the full trace)

IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error  at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:135)
| Error  at java.lang.Thread.run(Thread.java:680)




which are rather annoying since all the mailing list say, to just run the dependency report to see what causes this problem. Great idea exact that grails crashes before it can generate the report...

So after a while of searching and goggling and shouting random words at my imac, I found an ugly solution which works rather well for now.
Basically make your BuildConfig.groovy file look like this and it should fix your current issues...
    dependencies {
        
        runtime 'postgresql:postgresql:8.2-504.jdbc3'

        compile('xmlpull:xmlpull:1.1.3.1')

        compile('org.openscience.cdk:cdk-fingerprint:1.4.16') {
            transitive = false
        }
        compile('org.openscience.cdk:cdk-inchi:1.4.16') {
            transitive = false
        }
        compile('org.openscience.cdk:cdk-standard:1.4.16')
        compile('org.openscience.cdk:cdk-interfaces:1.4.16')
        compile('org.openscience.cdk:cdk-annotation:1.4.16')
        compile('org.openscience.cdk:cdk-io:1.4.16')
        compile('org.openscience.cdk:cdk-isomorphism:1.4.16')
        compile('org.openscience.cdk:cdk-render:1.4.16')
        compile('org.openscience.cdk:cdk-renderbasic:1.4.16')
        compile('org.openscience.cdk:cdk-renderawt:1.4.16')
        compile('org.openscience.cdk:cdk-smarts:1.4.16')  {
            transitive = false
        }
        compile('org.openscience.cdk:cdk-extra:1.4.16')  {
            transitive = false
        }
        compile('org.openscience.cdk:cdk-dict:1.4.16')  {
            transitive = false
        }
        compile('jama:jama:1.0.2')  {
            transitive = false
        }
        compile('org.openscience.cdk:cdk-formula:1.4.16')
        compile('org.openscience.cdk:cdk-smsd:1.4.16')
        compile('xpp3:xpp3:1.1.4c')
        compile('java3d:vecmath:1.3.1')
        compile('net.sf.jni-inchi:jni-inchi:0.7')
    }
Maybe this help someone, who has the same issues with old XML-Apis and Xerces and so