I am using grails 2.2.1, in windows.
I want to develop a plugin which depends on spring-security-core plugin, so I add dependency into BuildConfig.groovy of my plugin:
plugins {
compile ':spring-security-core:1.2.7.3'
}
Then in my grail application project, I specify the dependency in BuildConfig.groovy in:
grails.plugin.location."xxxxx" = "../grails-plugins/xxxx"
After that, when I try to refresh dependency of my grail application project, it always prompt
unable to resolve class org.springframework.security.authentication.UsernamePasswordAuthenticationToken
this class is a class depends on by spring-security-core plugin and my plugin use this class too.
Is it a grails bug? or I miss something? Please help, thanks in advance!
I tested here. In Grails 2.2.1 you need to set legacyResolve to true since
Grails 2.2 no longer uses the BuildConfig of the plugin for dependency
resolution and only uses data provided by POMs
When you set this and refresh dependencies the install messages of Spring Security Core will appear.
Related
I am using Grails 2.3.8
I am using - org.yaml.snakeyaml.Yaml class.
Didn't have any issues with GGTS workspace finding the package during auto
complete in the source.
But when running the application I get
java.lang.ClassNotFoundException:org.yaml.snakeyaml.Yaml
My assumption was this is part of the core Grails and the jars will be
included automatically.
Do I have to configure and add the jar or dependency in the
BuildConfig.groovy ?
Grails 3 uses Yaml and includes it as a dependency but prior to 3.0 it didn't, so you need to configure it like any third-party dependency in BuildConfig.groovy, e.g.
dependencies {
...
compile 'org.yaml:snakeyaml:1.14'
}
I asked this question on the Grails user list but didn’t get a response, so I’ll rephrase it here. I’m the author of a Grails plugin (https://github.com/kensiprell/grails-atmosphere-meteor), which has two external dependencies defined in BuildConfig.groovy.
When the plugin is installed in a new Grails 2.2.x application, the external dependencies are not resolved in the app. When running it I get "unable to resolve class" errors on the import statements for the classes defined in the plugin’s dependencies.
A plugin user should be able to insert the plugin dependency in an app’s BuildConfig.groovy and have the two external dependencies resolved automatically. grails.project.dependency.resolution.legacyResolve should be the default value of false.
Additionally, I want to test the plugin using https://github.com/kensiprell/grails-plugin-test-script before publishing it to the Grails plugin portal. I have an artifactory repo running on localhost (defined as localPluginReleases in the plugin's BuildConfig.groovy).
The plugin is built using Grails 2.2.3 and uses release plugin version 2.2.1. I've tried varying combinations of the below without success:
grails clean
grails compile
grails maven-install
grails generate-pom
grails package-plugin
grails publish-plugin --noScm --repository=localPluginReleases
grails maven-deploy --repository=localPluginReleases
What is the correct step-by-step to get this working?
My grails app should work with two plugins: shiro and quartz2.
I'm add both of plugins to BuildConfig.groovy:
compile ":shiro:1.1.4"
compile ":quartz2:2.1.6.2"
(after that ide downloaded them)
The problem in dependencies: shiro depends from shiro-quartz:1.2.0 and shiro-quartz from org.opensymphony.quartz 1.6.1
I wonder why but quartz2 looking for methods implementation to quartz-1.6.1.jar.
Quartz2 cannot find implementations and that's why project cannot be build.
I think quartz2 should search methods implementations in "normal" quartz lib, like quartz:1.0-RC7, but he do not.
So, how can i solve shiro and quartz2 plugins conflict?
I heard about dependency excluding, but i not sure about this sugesstion.
P.S. with quartz(not quartz2) the same problem occurred
You can run dependency-report to check what dependencies the plugins are trying to add to your project. The problem seems to be that shiro-quartz depends on quartz 1.x and quartz plugin uses quartz 2.x.
Normally you could do:
compile (":shiro:1.1.4") {
excludes('org.opensymphony.quartz:quartz')
}
But there's a bug, and this transitive dependency isn't excluded. There's an open ticket to adjust this.
The good thing is that there's a workaround:
compile (":shiro:1.1.4") {
excludes([name: 'quartz', group: 'org.opensymphony.quartz'])
}
With this, Grails will use Quartz 2.x only.
I've installed the asynchronous mail plugin into a Grails 2.1.4 application. This plugin has a dependency on version 2.1.1 of the Hibernate plugin, whereas my app depends on version 2.1.4 of the Hibernate plugin.
Every time I execute a Grails command like run-app, I am asked the following question:
You currently already have a version of the plugin installed [hibernate-2.1.4]. Do you want to update to [hibernate-2.1.1]? [y,n] n
I know that run-app has an --non-interactive argument, but AFAIK this will automatically answer y to this question. Ideally, I would like to solve this problem by excluding the transitive Hibernate plugin dependency from the asynchronous mail plugin, but transitive dependency exclusion only seems to be possible for JAR dependencies.
The docs in the plugin page are wrong - you need this for any Grails app not using version 2.1.1, not just older apps:
compile(":asynchronous-mail:1.0-RC3") {
excludes 'hibernate'
}
After I upgraded to Grails 2.2.1 my inline plugin directives have stopped working.
For example the following does not resolve the plugin.
grails.plugin.location.'commons' = "../../common/commons-upgrade"
I followed the guide
http://grails.org/doc/latest/guide/upgradingFromPreviousVersionsOfGrails.html
which says to add the following
legacyResolve true to the BuildConfig.groovy but it still doesn't work.
Also the guide claims that
Grails 2.2 no longer uses the BuildConfig of the plugin for dependency resolution and only uses data provided by POMs
Although I have found that the application neither requires a POM and by default still uses the BuildConfig for plugin resolution. Given that Grails depends on some plugins by default I would expect the create-app to automatically generate a POM and for it to be used by default.
Can someone resolve my confusion with dependency resolution?
You can use
grails generate-pom
to create a pom for your plugin which can be used for deployment, however that doesn't fix the problem you're seeing at the moment.
The only way I've found to get around it is to set legacyResolve true in the build config as per http://grails.org/doc/2.2.1/guide/upgradingFromPreviousVersionsOfGrails.html
Hopefully that will be fixed soon.