error while running grails command line - grails

in my grails 2.3.4 application (after upgrading from grails 2.2.3) , when I run the grails command line grails install-plugin pluginname I get the below error , even I tried grails list-plugins I'm getting the same error:
Error Resolve error obtaining dependencies: Failed to resolve dependencies (Se log level to 'warn' in BuildConfig.groovy for more information): org.grails.plugins:tomcat:2.3.4 (Use --stacktrace to see the full trace)
i reviewed the BuildConfig.groovy there is no tomcat 2.3.4 what i'm using is 7.0.47 , here are my plugins :
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime :resources:1.1.6
build ":tomcat:7.0.47"
runtime database-migration:1.2.1
compile :cache:1.0.1
how i can solve this issue ?

you problem seems slovable due to the fact that ...you need to clean the grails project first without building it and then do
grails refresh-dependencies
and then finally
grails clean
and
grails compile
When you run refresh-dependencies your Grails application will try to resolve your grails plugins defined in BuildConfig.groovy file. If this doesn't work remove the plugins and do the above step until the error you have posted in the question vanished then add the correct plugin format and version with the correct precedence dependency, then make sure everything should work well.

Your dependencies are in a dependency block, but they are plugins. Put them in the plugins block of your BuildConfig.groovy file. So instead of what you have, put this:
plugins {
runtime ":hibernate:3.6.10.6"
runtime ":jquery:1.8.3"
runtime ":resources:1.1.6"
build ":tomcat:7.0.47"
runtime ":database-migration:1.2.1"
compile ":cache:1.0.1"
}
Also, this is no "dependency" block. This is a dependencies block, however. See this link for information on dependency resolution in Grails.

I need to add the following repo in buildconfig.groovy to the repositories section:
mavenRepo "https://repo.grails.org/grails/plugins"

Related

Grails 1.3.7 "is not a valid Grails plugin. No plugin.xml descriptor found!" error when trying to install plugins in Jenkins

I'm facing these random errors even after having them installed via command "grails install-plugin plugin_name plugin_version". This is part of a Jenkins build where the code is first checked-out, then built with grails, then "prod war" as target.
Grails is able to find and install the plugins it needs, but still fails for different version of this plugin and I don't know where it is picking that versions from.
Here's a snippet of the error: https://gist.github.com/marianogg9/e208233042c721bdbd87
Here's my BuildConfig.groovy: https://gist.github.com/marianogg9/438dc35d4643affe6e19
Any help is greatly appreciated, I've run out of options here.
Thanks!
It looks like you are defining spring security core jar dependency as plugin and that's why it can't be prosessed.
In your BuildConfig.groovy move it from the plugins {} to dependencies {}
grails.project.dependency.resolution = {
...
plugins {
compile ":burning-image:0.5.0"
compile ":email-confirmation:1.0.5"
compile ":mail:1.0"
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
}
dependencies {
...
compile ":spring-security-core:1.2.7.2"
}
}

Error loading UrlMappingsPlugin in Grails

When creating a basic grails plugin and compiling with Maven, I get this error message:
Error loading plugin manager: Could not create a new instance of class
[org.codehaus.groovy.grails.plugins.web.mapping.UrlMappingsGrailsPlugin]!
(Use --stacktrace to see the full trace)
Grails version 2.4.3
The solution to this issue is to add the tomcat plugin (no idea why):
Add this to BuildConfig.groovy:
build ":tomcat:7.0.55"
Then you may need to regenerate the pom.xml file using grails create-pom.
This appears to be related to this bug.

Error installing Grails plugin to local maven repository

I have created a Grails plugin using Grails 2.3.3 and trying to use the plugin in a Grails application which was also created using Grails 2.3.3. Now, to use the plugin in the application, it needs to be published to a plugin repository first. So I attempted to publish the plugin into the local repository by using the commands:
grails clean
grails compile
grails maven-install
For the grails maven-install command I selected the option 2)InstallPlugin. But then got an error:
Error installing plugin: No such property: ERROR_MESSAGE for class: Inst
allPlugin (Use --stacktrace to see the full trace)
Ran the last command above with option --stacktrace and --verbose but did not get any clue as to what the problem might be. I also removed %HOME%/.grails directory and reran the above commands and still came with the same error.
After googling, I found a JIRA for this issue which was closed stating that it happens when Grails version is changed and cleaning up cache files will get rid of this issue. However, that solution is not working for me and, by now, I have spent couple of hours trying to fix this. Also I did not change my Grails version.
Has anyone faced this issue with Grails 2.3.3 or with any recent version of Grails? What was the solution?
Don't use install-plugin, add a dependency in BuildConfig.groovy.
I don't know where the 2)InstallPlugin "option" is coming from. The maven-install script packages your plugin and generates a POM file and the other files needed to be a valid published plugins. Then it copies these files to your local M2 directory, e.g. if your plugin name is "mycoolplugin" the files are copied to $HOME/.m2/repository/org/grails/plugins/mycoolplugin
Now you can "install" the plugin as if it had been published in a remote repo. Add a dependency in the app's BuildConfig.groovy using the usual format, e.g.
plugins {
build ":tomcat:7.0.50"
compile ":scaffolding:2.0.1"
runtime ":hibernate:3.6.10.7"
...
compile ":mycoolplugin:0.1"
}

Grails GGTS - Refresh dependencies failed

I get build errors in the GGTS Groovy error when I import a class from an external jar.
I've added a jar dependency to my Grails project using BuildConfig.groovy that is installed to my local maven repo:
grails.project.dependency.resolution = {
...
repositories {
...
mavenLocal()
}
...
}
dependencies {
runtime(group: 'groupId', name: 'nameId', version: 'versionId')
}
When I import a class from that jar, I get the error in the GGTS Groovy editor Groovy: unable to resolve class... I can run grail compile and grails run-app from either the command line or GGTS. So clearly Grails has no problem finding the jar and referencing it from my code.
Another question suggested that the user run 'Refresh dependencies (or shortcut "Alt+G, R")' but that results in an error dialog.
Refresh dependecies failed
java.lang.NullPointerException
Opening up the Error Log View shows the stacktrace:
java.lang.NullPointerException
at org.grails.ide.eclipse.core.internal.classpath.PluginDescriptorParser.handleSimpleNode(PluginDescriptorParser.java:216)
at org.grails.ide.eclipse.core.internal.classpath.PluginDescriptorParser.parse(PluginDescriptorParser.java:100)
at org.grails.ide.eclipse.core.internal.classpath.GrailsPluginParser.parse(GrailsPluginParser.java:39)
at org.grails.ide.eclipse.core.internal.plugins.PerProjectPluginCache.parseData(PerProjectPluginCache.java:110)
at org.grails.ide.eclipse.core.internal.plugins.PerProjectPluginCache.initializePluginData(PerProjectPluginCache.java:81)
at org.grails.ide.eclipse.core.internal.plugins.PerProjectPluginCache.refreshDependencyCache(PerProjectPluginCache.java:103)
at org.grails.ide.eclipse.commands.GrailsCommandUtils$1.run(GrailsCommandUtils.java:392)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
at org.grails.ide.eclipse.commands.GrailsCommandUtils.refreshDependencies(GrailsCommandUtils.java:372)
at org.grails.ide.eclipse.core.internal.classpath.GrailsClasspathContainerUpdateJob.runInWorkspace(GrailsClasspathContainerUpdateJob.java:89)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
I am using:
Grails 1.3.7
GGTS 3.4.0.RELEASE-e4.3.1-linux-gtk-x86_64
How do I fix this error and be able to edit my code in GGTS without errors?
I faced a similar issue in GGTS where the project was getting compiled fine from command prompt (grails run-app) but GGTS was showing problem as "Unable to resolve class GrailsTestCase". I checked Dependency management (project right click -> Grails Tools) and it was enabled. I just disabled it and enabled it again. This resolved the issue in my case. Could be some problem with IDE.

I can't install spring-security-core plugin in Grails

I have windows 7 and Grails-2.0.4. Trying to install plugin spring-security-core. I've tried from everywhere: cmd, Idea, SPS. Nothing works. Everywhere the same error:
!Error resolving plugin [name: spring-security-core, group: org.grails.plugins, version: latest.integration(1.2.7.3 in SPS)]. Plugin not found.
!Error Plugin not found for name [spring-security-core] and version[not specified(1.2.7.3 in SPS)]
I tried to put the zip-file of this plugin in different directories. Doesn't work. With connection everything is OK. Help me please.
Check the repositories section of your BuildConfig dependencies, and add the following if it is not already there:
grailsRepo "http://grails.org/plugins"
The grails plugin repository moved earlier this year and the old repository does not contain any plugin versions released since April 2012. I don't remember exactly which versions of Grails will use the new repository by default, the change happened somewhere around 2.0.3/4.
The preferred way to install it is to add a dependency in BuildConfig.groovy. The syntax for this is listed for each plugin, in this case from http://grails.org/plugin/spring-security-core: compile":spring-security-core:1.2.7.3"(look for the 'Dependency' section at the top). So theplugins` section of your BuildConfig.groovy should look like this:
plugins {
runtime ":hibernate:$grailsVersion"
build ":tomcat:$grailsVersion"
...
compile ":spring-security-core:1.2.7.3"
}
Alternatively you can install it with the install-plugin script:
$ grails install-plugin spring-security-core
but the dependency approach is the better way.

Resources