在安装了SpringSecurityCoreGrails插件之后,您是如何了解jar文件的?
我已经在一个grails项目中安装了SpringSecurityCore,但出于某种原因,IDEA并没有自动获取jar文件。我可以使用grails命令行部署应用程序并运行测试,一切正常。。。但这一想法仍有曲折之处。有没有一种方法可以让我在安装插件后自动拿起罐子在安装了SpringSecurityCoreGrails插件之后,您是如何了解jar文件的?,grails,plugins,jar,intellij-idea,installation,Grails,Plugins,Jar,Intellij Idea,Installation,我已经在一个grails项目中安装了SpringSecurityCore,但出于某种原因,IDEA并没有自动获取jar文件。我可以使用grails命令行部署应用程序并运行测试,一切正常。。。但这一想法仍有曲折之处。有没有一种方法可以让我在安装插件后自动拿起罐子 打开项目结构窗口 在项目设置中选择模块 然后选择插件模块。它应该命名为“myproject grailsPlugin” 然后选择“依赖项”选项卡 在相关模块中,选择Grails用户库(如果它不存在,请使用Add->Global Libra
就这样 我不是100%知道这个问题的真正根源是什么。据我所知,IntelliJ解析插件中的BuildConfig.groovy来配置依赖项。它似乎没有拾取自动生成的dependencies.groovy。打包的spring安全核心插件只包含dependencies.groovy,没有BuildConfig.groovy 我已将以下代码段添加到我的应用程序的BuildConfig.groovy中
dependencies {
compile('org.springframework.security:org.springframework.security.core:3.0.2.RELEASE') {
excludes 'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core'
}
compile('org.springframework.security:org.springframework.security.web:3.0.2.RELEASE') {
excludes 'com.springsource.javax.servlet',
'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.aop',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core',
'org.springframework.web'
}
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.5'
}
grails.project.plugins.dir = "./plugins" //breaks plug-ins in intellij
有了这些,IntelliJ“知道”了Spring安全JAR。为什么不右键单击项目根目录并单击“同步grails依赖项”…在我的例子(9.0.2)中,问题是grailsPlugins的类路径上没有grails库。因此编译依赖项将无法工作,并且您的修复fabien有点冗长:-)
IDEA通常有一个很好的自动错误修复(alt+enter),在这种情况下,它可以自动修复错误。它将要求您“将grails用户库添加到类路径”。工作起来很有魅力,但当然不必要当您在BuildConfig.groovy中将插件目录更改为默认目录以外的其他目录时,intellij 9.0.3似乎无法正确地从插件中提取依赖项
dependencies {
compile('org.springframework.security:org.springframework.security.core:3.0.2.RELEASE') {
excludes 'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core'
}
compile('org.springframework.security:org.springframework.security.web:3.0.2.RELEASE') {
excludes 'com.springsource.javax.servlet',
'com.springsource.org.aopalliance',
'com.springsource.org.apache.commons.logging',
'org.springframework.aop',
'org.springframework.beans',
'org.springframework.context',
'org.springframework.core',
'org.springframework.web'
}
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.5'
}
grails.project.plugins.dir = "./plugins" //breaks plug-ins in intellij
更改插件目录后,类未找到错误开始出现。我从模块中添加了依赖项(即SpringSecurityCore和springcache),现在intellij将jar依赖项添加到“Grails用户库”中,我可以编译我的应用程序。使用命令行从来没有任何问题
下面是我为springcache添加到BuildConfig的内容
dependencies {
//for spring-security-core
//对于springcache
编译(“net.sf.ehcache:ehcache-web:2.0.0”){
排除“ehcache-core”//ehcache-core由Grails提供
}
}这个解决方案很好。它同时影响项目中的每个人。你太棒了!我没有尝试过,但是IntelliJ可能已经在他们最新的EAP中修复了这个问题。只是对这个问题的一个跟进:在IntelliJ 9.0.3中,不再需要上述黑客攻击。spring-security-core-0.3.1没有lib/dir。