tonix
tonix

Reputation: 6949

How to replace a dependency in a Grails project created with the GGTS/Eclipse?

I am new to Grails, I would like to ask someone how can I replace a dependency in a Grails project (using GGTS/Spring Tool Suite/Eclipse)?

Basically, I am asking this because of this issue I am experiencing while trying to use the Vaadin plugin for grails inside a Grails project (here is the issue on GitHub -> https://github.com/ondrej-kvasnovsky/grails-vaadin-plugin/issues/48)

I have the following grails plugin which uses the 5.1.1.Final version of the hibernate dependency (it takes it from my local .m2 Maven repository, below a snippet from grails dependency-report).

Hibernate:

+--- org.grails.plugins:hibernate4:4.3.6.1
    |    \--- org.hibernate:hibernate-validator:5.1.1.Final

Additionally, I also use the vaadin plugin for grails:

Vaadin plugin for Grails:

org.grails.plugins:vaadin:7.3.9
|    \--- com.vaadin:vaadin-client:7.3.9
|         \--- com.vaadin:vaadin-shared:7.3.9
|              \--- com.vaadin.external.flute:flute:1.3.0.gg2
|              \--- com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:0.0.10.vaadin1
|              \--- com.vaadin.external.google:guava:16.0.1.vaadin1
|              \--- com.vaadin.external.json:json:0.0.20080701
|         \--- org.w3c.css:sac:1.3
|         \--- javax.validation:validation-api:1.0.0.GA
|         \--- javax.validation:validation-api:1.0.0.GA

Here the plugin entries inside the BuildConfig.groovy file:

plugins {
    ...
    // this is the line I added
    compile ":vaadin:7.3.9"
    ...
    // This line is created automatically by the new project wizard
    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"        
}

Now as you seen, the Vaadin plugin uses javax.validation:validation-api:1.0.0.GA but the Hibernate version used by grails by default is the latest one (5.1.1.Final) which is in turn incompatible with javax.validation:validation-api:1.0.0.GA. Instead either a downgrade to version 4.x.x of hibernate-validator or an upgrade of the javax.validation library from validation-api:1.0.0.GA to validation-api:1.1.0.Final should be made.

I have found that I can switch the version of the Hibernate grails plugin (as it is advised inside BuildConfig.groovy):

 plugins {
        ...
        // this is the line I added
        compile ":vaadin:7.3.9"
        ...            
        runtime ":hibernate:3.6.10.18" // instead of default ":hibernate4:4.3.6.1"
 }

This effectively installs Hibernate 3 for Grails which uses hibernate-validator-4.1.0.Final instead of 5.1.1.Final, therefore it should be compatible with javax.validation 1.0.0, but I still get the error for which I opened the issue on GitHub linked at the start of this question.

Now, as Hibernate 3 for Grails uses 4.1.0.Final I can only think that I can try with hibernate-validator-4.3.1.Final (I have downloaded the .jar) to see what happens or someway replace validation-api:1.0.0.GA installed with the Vaadin Grails plugin and try again with Hibernate 5.1.1.Final.

But how can I safely replace these dependencies without broke anything? Or, even better, did someone experience the same problem with the Vaadin plugin for Grails and did you come with a better solution?

Thanks for the attention. Hope to resolve this trivial issue once for all.

Upvotes: 0

Views: 230

Answers (1)

tonix
tonix

Reputation: 6949

Thanks to a comment of a user on the same issue on GitHub:

https://github.com/ondrej-kvasnovsky/grails-vaadin-plugin/issues/48#issuecomment-77685018

I resolved by replacing runtime ":hibernate4:4.3.6.1" with a bit older version runtime ":hibernate4:4.3.5.5" and it works.

Upvotes: 0

Related Questions