Explicitly define propertyUtils in TapeRepresenter #73

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@ecin

When trying to run tests from within IntelliJ, I hit the following error:

groovy.lang.MissingPropertyException: No such property: propertyUtils for class: co.freeside.betamax.tape.yaml.TapeRepresenter

Per http://undefined.com/ia/2008/03/17/groovy-no-such-property-x-for-class-y/, seems we need to explicitly declare propertyUtils as a member of the TapeRepresenter class. 

There may be more cases were similar edits need to be made.

@ecin ecin Explicitly define propertyUtils in TapeRepresenter
When trying to run tests from within IntelliJ, I hit the following error:

`groovy.lang.MissingPropertyException: No such property: propertyUtils for class: co.freeside.betamax.tape.yaml.TapeRepresenter`

Per http://undefined.com/ia/2008/03/17/groovy-no-such-property-x-for-class-y/, seems we need to explicitly declare `propertyUtils` as a member of the `TapeRepresenter` class. 
6a8bfe8
@robfletcher

That line is invoking BaseRepresenter.setPropertyUtils from the SnakeYaml library. Have you overridden that dependency with a different version by any chance?

@robfletcher

I'm not able to recreate this error. Which version of IntelliJ is giving you the problem? I've tried 11 and 12 Ultimate & the tests work fine.

@ecin

pom looks like:

    <repositories>
        <repository>
            <id>org.sonatype.oss</id>
            <name>Sonatype</name>
            <url>http://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.12</version>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-apache-client</artifactId>
            <version>1.12</version>
        </dependency>

        <dependency>
            <groupId>co.freeside</groupId>
            <artifactId>betamax</artifactId>
            <version>1.2-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.0.6</version>
        </dependency>

        <dependency>
            <scope>test</scope>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
        </dependency>
    </dependencies>

Which Groovy version are you using in tests?

@robfletcher

Betamax is using Groovy 1.8.8 but I've tried upgrading Groovy to 2.0.6 and it still works fine for me.

@robfletcher

I can only think this is a problem with Maven's Groovy compiler which (last time I used it) does stub generation then uses javac rather than doing proper cross-compilation using groovyc.

Can you try changing the line in question to be:

setPropertyUtils(new TapePropertyUtils())

which is what the equivalent code in Java would be. If that fixes it then it's a Maven bug as it's not compiling Groovy correctly.

@robfletcher

This should no longer be a problem now everything's written in Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment