Install Mail Plugin - says that install-plugin is deprecated - grails

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.

Related

How to install grails db-reverse-engineer

Trying to use the Grails db-reverse-engineer plugin. As this plugin doesn't work with Grails 3 I used SDKMAN to install older versions of Grails just to generate the models. First tried version 2.5.2 (which was still incompatible with the tutorial) and then spun back to 2.2.5. Following the tutorial still fails to install the plugin:
$grails create-app reveng-test
| Created Grails Application at /home/user/pnvStuff/grails/reveng-test
$ cd reveng-test
$ grails install-plugin db-reverse-engineer
| 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.
| Error resolving plugin [name:db-reverse-engineer, group:org.grails.plugins, version:latest.integration]. Plugin not found.
| Error Plugin not found for name [db-reverse-engineer] and version [not specified]
I also tried installing the plugin by referencing it in the plugins section of the BuildConfig.groovy.
runtime ':db-reverse-engineer:0.5.1'
How can I get this plugin installed to generate the needed domain classes?
Grails 2.x (and 1.x for that matter) plugins are now in a repository that isn't included in BuildConfig.groovy by default. You need to add the below Maven repo to your dependency resolution block.
grails.project.dependency.resolution = {
repositories {
mavenRepo "http://repo.grails.org/grails/repo/"
...

Why grails run-app tries to access remote servers during compiling

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.

Grails install-plugin git Error

Environment
Windows 7, Grails 2.2.0/2.X, GGTS
I have installed git on my computer successfully, I am now trying to install the Git plugin for grails using the command install-plugin command. I get the errors below, I have looked for a solution but have not found one yet.
Problems occurred (un)installing plugins. See details for more information
------System.out:-----------
| Loading Grails 2.2.0
| Configuring classpath.
| 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 git. Please wait...
| Error resolving plugin [name:git, group:org.grails.plugins, version:1.0-SNAPSHOT]. Plugin not found.
| Error Plugin not found for name [git] and version [1.0-SNAPSHOT]**
------System.err:-----------
i faced this problem when i was installing the searchable plug in but i figured out that my internet connection is through proxy so i got direct connection and it was installed successfully
Sherif
I ended up using the grails integrate-with --git command instead

Grails always tries to uninstall plugin

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.

Installing Grails Spock Plugin in 2.0.0M1

I'm kicking the tires on Grails 2.0.0M1 and Springsource Tool Suite 2.7.1, but I'm having problems installing the spock plugin.
When I run "grails install-plugin spock 0.6-groovy-1.8-SNAPSHOT" I get:
| Downloading: spock-0.6-groovy-1.8-SNAPSHOT.pom
:: problems summary ::
:::: ERRORS
grailsCentral: bad organisation found in http://svn.codehaus.org/grails-plugins/grails-spock/tags/RELEASE_0_6-groovy-1_8-SNAPSHOT/spock-0.6-groovy-1.8-SNAPSHOT.pom: expected='org.grails.plugins' found='org.spockframework'
| Error resolving plugin [name:spock, group:org.grails.plugins, version:0.6-groovy-1.8-SNAPSHOT]. Plugin not found.
| Error Plugin not found for name [spock] and version [0.6-groovy-1.8-SNAPSHOT]
Any idea how to work around this?
Had the same problem. This was fixed earlier today. Try grails install-plugin spock 0.6-SNAPSHOT (without "groovy-1.8").
See:
http://jira.grails.org/browse/GPSPOCK-5?focusedCommentId=65695&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-65695
Grails 1.4/2.0 requires Groovy 1.8, but they have some problems with getting Spock version with support for it into Maven Central. The method described here worked OK for us with Grails 1.4.M1. It's a little cumbersome, because it requires to manually build the JAR and install it into the local Maven repository (thus, needs to be performed on every machine), but you can also try to deploy it to a local Nexus/Artifactory.

Resources