How to install Grails 2.4.4 plugin from zip?

2019-09-04 05:43发布

问题:

I have a need for the grails-spring-security-ldap plugin in 2.4.4. However, the latest maven-published plugin doesn't work with 2.4.X, but commits have been made to the git repo (https://github.com/grails-plugins/grails-spring-security-ldap) to make it work.

I've downloaded the code and successfully packaged it a zip file. I've also read that you can no longer drop zips in the the project/lib directory and expect it to be found after adding it to BuildConfig.groovy. So, I installed to my local m2 directory with:

grails maven-install ./grails-spring-security-ldap-2.0-SNAPSHOT.zip

I then added 'compile ":grails-spring-security-ldap:2.0-SNAPSHOT"' to BuildConfig.groovy. However, it still tries to find it in the grails repo (see below error) and won't look locally. What am I doing wrong?

Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:grails-spring-security-ldap:zip:2.0-SNAPSHOT in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:grails-spring-security-ldap:zip:2.0-SNAPSHOT in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:grails-spring-security-ldap:zip:2.0-SNAPSHOT in grailsCentral (https://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Could not find artifact org.grails.plugins:grails-spring-security-ldap:zip:2.0-SNAPSHOT in grailsCentral (https://repo.grails.org/grails/plugins)
|Run 'grails dependency-report' for further information.

回答1:

Since Grails 2.3, it is no longer possible to install plugins directly from the file system.

If you wish to use local plugins then run 'maven-install' in the plugin directory to install the plugin into your local Maven cache.

Then inside your application's grails-app/conf/BuildConfig.groovy file declare the dependency and it will be resolved from your Maven cache.

If you make a change to the plugin simply run 'maven-install' in the directory of the plugin project again and the change will be picked up by the application