Each time I'm runnin Grails app, it tries to uninstall an plugin (resources-1.2.RC2). When it installed using IntelliJ IDEA, it uninstall it sucessfully, I see:
| Uninstalled plugin [resources]
and fails with:
| Error Fatal error during compilation org.apache.tools.ant.BuildException:
srcdir "***/2.1.1/projects/***/plugins/resources-1.2.RC2/grails-app/resourceMappers"
does not exist! (Use --stacktrace to see the full trace)
Notice, that I can install this plugin only by using InteliJ IDEA, when I'm trying to install it from command line (using grails install-plugin resources) it logs only:
| Plugin not installed.
If plugin isn't installed, and i'm doing grails run-app, it writes (each time!):
| Warning No plugin [resources-1.2.RC2] installed, cannot uninstall
app fails because cannot find required classes from resources plugin.
--
I guess it's happening because of corrupted config inside ~/grails (I've tried to uninstall it some time ago), and it execute this action on each run. But I can find.
I even tried to remove project dir from ~/.grails/2.1.1/projects - not helped.
How I can stop it from removing this plugin? Whre grails stores infomration what plugin it shoud uninstall?
PS Also, I can't understand, why plugins { compile ":resources:1.2.RC2" } in BuildConfig.groovy not used by grails? I always need to run install-plugin command to make it working?
Actually, install-plugin is deprecated. Use BuildConfig.groovy instead. To get everything set up properly, delete all plugins from your application.properties file. Then add them to your BuildConfig.groovy.
IntelliJ is not really good with catching these kind of updates, so you might have to run refresh-dependencies manually after updating your BuildConfig. That is properly why it didn't work before.
Related
here is a grails project, but if you have grails 3.3 installed, and try to run it with "grails run-app" it throws the error:
| Error Error initializing classpath: Unsupported method: GrailsClasspath.getError().
The version of Gradle you connect to does not support that method.
Any ideas how to run it? Do I have to find, install, then change my paths to point to the old version, or is there some other way using gradle?
I see there is something called gradlew.bat, but looking through the grails docs, it doesnt say how to use it. is gradlew.bat like the grails command line, and, if so, where is it documented on how to use it?
Any ideas how to run it?
./gradlew bootRun
Do I have to find, install, then change my paths to point to the old
version, or is there some other way using gradle?
No, you don't have to install Gradle and you don't have to do anything with your PATH. That is the point of the wrapper (gradlew).
When I run grails war, on Bamboo, I get the following error.
13-Apr-2015 11:15:53 | Configuring classpath
13-Apr-2015 11:15:59 | Running pre-compiled script
13-Apr-2015 11:15:59 | Error Script not found: Upgrade
Now I know that grails upgrade command has been removed from 2.4.4 so this is the cause but why is it (Upgrade) calling it in Bamboo. I have updated grailsw and grailsw.bat to be 2.4.4 but is still calling it? My app is set to 2.4.4 (application.properties). What could be the reason it is calling this(Upgrade) and/or how do I stop it?
From what I can tell, being in the same boat, the grails plugin itself is calling grails upgrade before running any commands you put in there.
The way I've got this working with 2.4.4 is to use a command instead of the build-in grails task.
My command simply maps to C:\grails\grails-2.4.4\bin\grails.bat and I just pass it command line args: -Dgrails.env=alpha war myApp-alpha.war
It's not as seamless doing multiple commands (like, clean -> test-app -> war), but you can do individual commands for each one, depending on the needs.
It looks like, its a Bamboo plugin for Grails has some bug.
For work around:
You! Could have added dummy upgrade script into your code.
For adding upgrade script:
grails create-script upgrade
After adding upgrade script, it will fix missing upgrade script issue on Bamboo.
I got this warning when i tried to install the mail plugin.
Loading Grails 2.2.4
| Environment set to development.....
| 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 mail. Please wait...
The command i used was install-plugin mail. When i checked the documentation it as well shows me the same command.
Can someone direct me by telling me what the correct command is?
You don't need to run any command, just declare the plugin dependency in BuildConfig.groovy like so:
plugins {
runtime ":mail:1.0.4"
}
Remove any reference to the plugin that may exist in application.properties.
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"
}
I found there are some errors during my grails application compiling.
| Loading Grails 2.0.4
| Configuring classpath
:: problems summary ::
:::: ERRORS
Server access Error: Unexpected end of file from server
url=http://plugins.grails.org/grails-shiro/tags/RELEASE_1_2_0-SNAPSHOT/shiro-1.2.0-SNAPSHOT.pom
But I can access the above url using my browser. What does the error mean? and is there any way to avoid such problems during compiling? Or can I compile my grails app locally?
when I need some grails plugin, I usually run
grails install-plugin xxx
to install xxx plugins. I noticed that there are some records automatically written in 'application.properties'. And the plugins are always installed in my ~/.grails//projects/plugins/, I am wondering whether there are ways to compile grails app locally?
You have a SNAPSHOT plugin, that means that Grails have to refresh this plugin periodically (once a day).
To disable remote repositories you can use --offline to work offline:
grails --offline run-app
Or disable it completelly by adding into BuildConfig.groovy:
grails.offline.mode=true
See docs for Dependecy Resoultion - https://grails.github.io/grails2-doc/2.0.4/guide/conf.html#dependencyRepositories
P.S. Latest stable version of Shiro plugin is 1.1.4, you could also use it instead of 1.2.0-SNAPSHOT. Stable version will be downloaded only once.