Grails/Gradle Plugin for Grails 2.0 - grails

I'm trying to use the grails-gradle plugin with grails version 2.0. Here is my build script:
buildscript {
repositories {
mavenRepo url: "http://repo.grails.org/grails/core/"
}
dependencies {
classpath "org.grails:grails-gradle-plugin:1.1.1-SNAPSHOT",
"org.grails:grails-bootstrap:2.0.0"
}
grailsVersion="2.0.0"
}
apply plugin: "grails"
repositories {
mavenCentral()
mavenRepo url: "http://repo.grails.org/grails/core/"
}
dependencies {
compile "org.grails:grails:2.0.0",
"org.grails:grails-core:2.0.0",
"org.grails:grails-crud:2.0.0",
"org.grails:grails-datastore-core:1.0.2.RELEASE",
"org.grails:grails-datastore-gorm:1.0.2.RELEASE",
"org.grails:grails-hibernate:2.0.0",
"org.grails:grails-logging:2.0.0"
}
The dependencies at the bottom of the script are different than the original "1.3.4" located here. When I use this script to create a grails project with gradle grails-init it works correctly, creating the project. When I try to use gradle grails-run-app I receive the following errors:
~>gradle grails-run-app
:grails-run-app
| Configuring classpath
| Error log4j:WARN No appenders could be found for logger (org.springframework.core.io.support.PathMatchingResourcePatternResolver).
| Error log4j:WARN Please initialize the log4j system properly.
| Error log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
| Compiling 38 source files
| Compiling 8 source files.....
| Error Error: The following plugins failed to load due to missing dependencies: [hibernate]
- Plugin: hibernate
- Dependencies:
! dataSource (Required: 2.0 > *, Found: Not Installed) [INVALID]
- i18n (Required: 2.0 > *, Found: 2.0.0)
- core (Required: 2.0 > *, Found: 2.0.0)
- domainClass (Required: 2.0 > *, Found: 2.0.0)
I'm assuming that this means I'm missing a dependency, but I have no idea what dependency. It looks like hibernate is the culprit, but I have included the grails hibernate jar above. The list of jars between the two versions of grails are different, so I'm not sure which should be included (or maybe there isn't one and this will not work). The list of dependencies can be see here.
Any help resolving these errors would be much appreciated.
Using:
gradle 1.0, milestone-7 & grails 2.0.0
NOTE: the dependency "org.grails:grails-gradle-plugin:1.1.1-SNAPSHOT" is a local copy of the tip revision from github.

Thanks a lot. This is a very helpful thread, to answer your question, you need to add "org.grails:grails-plugin-datasource:2.0.1" on compile, it solved the problem on my machine.

Looks like you're missing a few dependencies... Check Gradle / Grails application for a complete example of how to do this.
Hope this helps!

Related

Error: The following plugins failed to load due to missing dependencies:

I updated a plugin to use cxf 2.0.3 - previously the plugin was using cxf 1.4.7.
Following is the updated buildconfig of the plugin.
plugins {
// starting with Grails 2.3 the tomcat plugin is not updated/released along with Grails, so hard code version
build(":tomcat:2.2.5",
":release:2.2.1",) {
export = false
}
compile ":cxf-client:2.0.3"
}
When my application tries to load the plugin, I get the following error.
I tried using the plugin on an existing project and new project and still get the error.
|Loading Grails 2.5.3
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
....
|Compiling 1 source files
..........................................................Error
|
Error: The following plugins failed to load due to missing dependencies: [msApi]
- Plugin: msApi
- Dependencies:
! cxf-client (Required: 1.4.7, Found: 2.0.3) [INVALID]
Process finished with exit code 1
Is there some cache file I need to delete?
Search for string: "1.4.7" in whole plugin project f.e. by grep -rn "1.4.7" and you will find all occurences of this string in project (and then you will decide to change it or to delete such a file from result).

Gradle cannot find plugin

I have the following in my build.gradle of my Grails 3 project.
dependencies {
...
compile "org.grails.plugins:spring-security-core:3.0.3"
// The following line was the true cause of my problem
compile("org.grails.plugins:spring-security-oauth-google:0.3.1")
...
}
Now when I run Gradle I get this error:
Error Error initializing classpath: Could not find spring-security-core.zip (org.grails.plugins:spring-security-core:3.0.3).
Searched in the following locations:
https://repo.grails.org/grails/core/org/grails/plugins/spring-security-core/3.0.3/spring-security-core-3.0.3.zip (Use --stacktrace to see the full trace)
If I go to the specified path I do see the plugin but just as reported there is no zip file.
What am I doing wrong here?
The root for this problem I found in a little bit different place than expected.
I am working on upgrading a Grails 2.5 project to Grails 3 and I had lead myself on a wrong track. I needed to include spring-security-oauth-google and when it did not work as expected I also included spring-security-core which then derailed me.
The cause of this problem is dependencies being loaded from dependencies I have in my own project. In order to avoid loading those dependencies - called transitive dependencies - the following has to be done:
plugins {
compile "org.grails.plugins:spring-security-core:3.0.3"
compile("org.grails.plugins:spring-security-oauth-google:0.3.1") {
exclude group: 'org.grails.plugins', module: 'spring-security-core'
}
}
This will load the spring-security-core 3.0.3 correctly ignoring the dependency from spring-security-oauth-google.

The install-plugin command is deprecated in Grails

i am new in grails..i try to install plugin using the command "install-plugin easygrid:1.5.0" in run. i got the warning as follow
"| Warning The install-plugin command is deprecated and may be removed from a future version of Grails. Plugin dependencies should be expressed in grails-app/conf/BuildConfig.groovy. See http://grails.org/doc/2.2.x/guide/conf.html#pluginDependencies.
| Resolving plugin easygrid:1.5.0. Please wait...
| Error resolving plugin [name:1.5.0, group:easygrid, version:latest.integration]. Plugin not found.
| Error Plugin not found for name [easygrid:1.5.0] and version [not specified]"
how to install-plugins in run or using BuildConfig.grooovy in grails?
thanks in advance
Look at the Dependency section on the Grails' plugin page, it should be located near the top of the page right under the author & licence sections. Copy the text from there into your BuildConfig.groovy file into the plugins block and (re)start Grails.
Your BuildConfig could look like this:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
//..some other configuration
grails.project.dependency.resolution = {
//..some other configuration and blocks
plugins {
//.. other plugins
compile ":easygrid:1.6.9"
}
}

Grails error installing plugin rest-client-builder 1.0.2, bad module descriptor

Using Grails 2.0.4, I'm trying to install rest-client-builder:1.0.2 using this...
grails install-plugin rest-client-builder
...but Grails returns the error below; I've tried cleaning, refreshing dependencies, etc., keep getting the same error...
:: #rest-client-builder;1.0.2: java.text.ParseException: inconsistent module descriptor file found in 'http://plugins.grails.org/grails-rest-client-builder/tags/RELEASE_1_0_2/rest-client-builder-1.0.2.pom': bad organisation: expected='' found='org.grails.plugins';
Also tried linking the plugin as a dependency from BuildConfig.groovy, but I get a similar error...
compile (":rest-client-builder:1.0.2"){ export = false}
grailsCentral: bad organisation found in http://plugins.grails.org/grails-rest-client-builder/tags/RELEASE_1_0_2/rest-client-builder-1.0.2.pom: expected='' found='org.grails.plugins'
Looks like you put it in the dependencies section but it should be in the plugins section:
plugins {
compile(':rest-client-builder:1.0.2') {
export = false
}
}
You should remove the plugins that are still in application.properties that the install-plugin script adds and only have them in BuildConfig.groovy.

grails ui plugin not working with grails 2.1.0

I wanted to test some of the features like expandablePannels etc before putting into another project, so I created a new project with a CRUD just so I can use grails ui
I am using Intellij 11, so I installed the plugin and was responded with the following error:
Error Failed to resolve dependencies (Set log level to 'warn' in BuildConfig.groovy for more information):
- org.grails.plugins:yui:[2.6.0,)
IDEA hook: Grails not found!
| Error java.lang.NullPointerException
| Error at org.jetbrains.groovy.grails.rt.Agent$2.run(Agent.java:99)
| Error at java.lang.Thread.run(Thread.java:680)
Anyone else having issues using this plugin ?
Yet easier:
Edit BuildConfig.groovy and change the lines of the plugin dependency by these:
compile ":yui:2.8.2.1"
compile (":grails-ui:1.2.3") {
excludes 'yui'
}
Just in case it's useful to you.
I ran into same problem while upgrading my app from grails 1.3.7 to 2.1.0. yui is a dependency for grails-ui plugin (as grails-ui needs bubbling, and bubbling needs yui :-/) This is what I did :
Goto .grails/ivy-cache/org.grails.plugin/grails-ui folder
Open the file ivy-(version).xml (ivy-1.2.3.xml)
Look for this line : <dependency org="org.grails.plugins" name="yui" rev="**[2.6.0,)**" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)">
Replace [2.6.0,) with 2.8.2, so final line will look like this : <dependency org="org.grails.plugins" name="yui" rev="2.8.2" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)">
grails clean and grails compile
After this, this error was gone for good.
Hope this helps.
UPDATE :
Thanks to predicador37 ; Much cleaner & groovy-way of doing this - Put this under plugins in BuildConfig.groovy :
compile ":yui:2.8.2.1"
compile (":grails-ui:1.2.3") {
excludes 'yui'
}

Resources