解决intellij ide中的依赖错误?

时间:2017-11-20 06:27:17

标签: spring-security grails-2.2

我创建了一个新的grails 2.2应用程序并添加了

compile ":spring-security-core:1.2.7.3"

在BuildConfig.groovy中的插件中。请注意,我使用的是grails 2.2。

然后我跑了> grails编译并抛出以下错误。

|Loading Grails 2.2.0
|Configuring classpath
.
|Environment set to development
........
|Compiling 156 source files
.Error 
|
Compilation error: startup failed:
Compile error during compilation with javac.
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\grails\plugins\springsecurity\BCryptPasswordEncoder.java:20: error: package org.springframework.security.authentication.encoding does not exist
import org.springframework.security.authentication.encoding.PasswordEncoder;
                                                           ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\grails\plugins\springsecurity\BCryptPasswordEncoder.java:30: error: cannot find symbol
public class BCryptPasswordEncoder implements PasswordEncoder {
                                              ^
  symbol: class PasswordEncoder
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\grails\plugins\springsecurity\DigestAuthPasswordEncoder.java:21: error: package org.springframework.security.authentication.encoding does not exist
import org.springframework.security.authentication.encoding.PasswordEncoder;
                                                           ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\grails\plugins\springsecurity\DigestAuthPasswordEncoder.java:22: error: package org.springframework.security.core.codec does not exist
import org.springframework.security.core.codec.Hex;
                                              ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\grails\plugins\springsecurity\DigestAuthPasswordEncoder.java:37: error: cannot find symbol
public class DigestAuthPasswordEncoder implements PasswordEncoder, InitializingBean {
                                                  ^
  symbol: class PasswordEncoder
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:31: error: package org.springframework.security.access does not exist
import org.springframework.security.access.AccessDecisionVoter;
                                          ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:32: error: package org.springframework.security.access does not exist
import org.springframework.security.access.ConfigAttribute;
                                          ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:33: error: package org.springframework.security.access does not exist
import org.springframework.security.access.SecurityConfig;
                                          ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:34: error: package org.springframework.security.access.vote does not exist
import org.springframework.security.access.vote.AuthenticatedVoter;
                                               ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:35: error: package org.springframework.security.access.vote does not exist
import org.springframework.security.access.vote.RoleVoter;
                                               ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:36: error: package org.springframework.security.web does not exist
import org.springframework.security.web.FilterInvocation;
                                       ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:37: error: package org.springframework.security.web.access.expression does not exist
import org.springframework.security.web.access.expression.WebSecurityExpressionHandler;
                                                         ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:38: error: package org.springframework.security.web.access.intercept does not exist
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
                                                        ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:39: error: package org.springframework.security.web.util does not exist
import org.springframework.security.web.util.AntUrlPathMatcher;
                                            ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:40: error: package org.springframework.security.web.util does not exist
import org.springframework.security.web.util.UrlMatcher;
                                            ^
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:48: error: cannot find symbol
       implements FilterInvocationSecurityMetadataSource, InitializingBean {
                  ^
  symbol: class FilterInvocationSecurityMetadataSource
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:50: error: cannot find symbol
    private UrlMatcher _urlMatcher;
            ^
  symbol:   class UrlMatcher
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:53: error: cannot find symbol
    private RoleVoter _roleVoter;
            ^
  symbol:   class RoleVoter
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:54: error: cannot find symbol
    private AuthenticatedVoter _authenticatedVoter;
            ^
  symbol:   class AuthenticatedVoter
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:55: error: cannot find symbol
    private WebSecurityExpressionHandler _expressionHandler;
            ^
  symbol:   class WebSecurityExpressionHandler
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:57: error: cannot find symbol
    private final Map<Object, Collection<ConfigAttribute>> _compiled = new LinkedHashMap<Object, Collection<ConfigAttribute>>();
                                         ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:61: error: cannot find symbol
    protected static final Collection<ConfigAttribute> DENY = Collections.emptyList();
                                      ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:75: error: cannot find symbol
    public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
                      ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:98: error: cannot find symbol
    protected abstract String determineUrl(FilterInvocation filterInvocation);
                                           ^
  symbol:   class FilterInvocation
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:104: error: cannot find symbol
    private Collection<ConfigAttribute> findConfigAttributes(final String url) throws Exception {
                       ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:158: error: cannot find symbol
    public Collection<ConfigAttribute> getAllConfigAttributes() {
                      ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:178: error: cannot find symbol
    public void setUrlMatcher(final UrlMatcher urlMatcher) {
                                    ^
  symbol:   class UrlMatcher
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:209: error: cannot find symbol
    protected UrlMatcher getUrlMatcher() {
              ^
  symbol:   class UrlMatcher
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:218: error: cannot find symbol
    public Map<Object, Collection<ConfigAttribute>> getConfigAttributeMap() {
                                  ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:254: error: cannot find symbol
    protected Collection<ConfigAttribute> buildConfigAttributes(final Collection<String> tokens) {
                         ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:269: error: cannot find symbol
    protected boolean supports(final ConfigAttribute config) {
                                     ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:274: error: cannot find symbol
    private boolean supports(final ConfigAttribute config, final AccessDecisionVoter voter) {
                                   ^
  symbol:   class ConfigAttribute
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-1.2.7.3\src\java\org\codehaus\groovy\grails\plugins\springsecurity\AbstractFilterInvocationDefinition.java:274: error: cannot find symbol
    private boolean supports(final ConfigAttribute config, final AccessDecisionVoter voter) {
                                                                 ^
  symbol:   class AccessDecisionVoter
  location: class AbstractFilterInvocationDefinition
C:\Users\sanjayg\.grails\2.2.0\projects\ACLTest\plugins\spring-security-core-

我感谢任何指导我在编译依赖项时遇到此错误的原因。是因为它无法从存储库中找到旧的插件。我还添加了以下存储库。

 mavenRepo "http://repo.spring.io/milestone/"

 mavenRepo "https://repo.grails.org/grails/plugins/org/grails/plugins/"

谢谢!

1 个答案:

答案 0 :(得分:0)

BuildConfig.groovy 中添加spring security插件,如下,

grails.project.dependency.resolver = "maven"

grails.project.dependency.resolution = {
     dependencies {
       //OTHER PLUGINS here
       runtime "org.springframework:spring-test:4.0.7.RELEASE"
     }
     plugins {
      //OTHER PLUGINS here
     compile ':spring-security-core:2.0-RC5'
     }
}

grails clean and grails compile或run-app