Explicitly define propertyUtils in TapeRepresenter #73

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@ecin

ecin commented Dec 25, 2012

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.

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. 
@robfletcher

This comment has been minimized.

Show comment Hide comment
@robfletcher

robfletcher Jan 3, 2013

Collaborator

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

Collaborator

robfletcher commented Jan 3, 2013

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

@robfletcher

This comment has been minimized.

Show comment Hide comment
@robfletcher

robfletcher Jan 3, 2013

Collaborator

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.

Collaborator

robfletcher commented Jan 3, 2013

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

This comment has been minimized.

Show comment Hide comment
@ecin

ecin Jan 8, 2013

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?

ecin commented Jan 8, 2013

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

This comment has been minimized.

Show comment Hide comment
@robfletcher

robfletcher Jan 9, 2013

Collaborator

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

Collaborator

robfletcher commented Jan 9, 2013

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

This comment has been minimized.

Show comment Hide comment
@robfletcher

robfletcher Jan 10, 2013

Collaborator

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.

Collaborator

robfletcher commented Jan 10, 2013

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 comment has been minimized.

Show comment Hide comment
@robfletcher

robfletcher Oct 30, 2013

Collaborator

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

Collaborator

robfletcher commented Oct 30, 2013

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