spring-guides / gs-securing-web

Securing a Web Application :: Learn how to protect your web application with Spring Security.

Home Page:http://spring.io/guides/gs/securing-web/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing dependencies in gradle file?

opened this issue · comments

Made all the steps, when trying to clean and build...

:clean UP-TO-DATE
:compileJava
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:4: package org.springframework.security.config.an
notation.authentication.builders does not exist
import org.springframework.security.config.annotation.authentication.builders.Au
thenticationManagerBuilder;
                                                                             ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:5: package org.springframework.security.config.an
notation.authentication.configurers does not exist
import org.springframework.security.config.annotation.authentication.configurers
.GlobalAuthenticationConfigurerAdapter;

^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:6: package org.springframework.security.config.an
notation.web.builders does not exist
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

                                                                  ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:7: package org.springframework.security.config.an
notation.web.configuration does not exist
import org.springframework.security.config.annotation.web.configuration.WebSecur
ityConfigurerAdapter;
                                                                       ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:8: package org.springframework.security.config.an
notation.web.servlet.configuration does not exist
import org.springframework.security.config.annotation.web.servlet.configuration.
EnableWebMvcSecurity;
                                                                               ^

C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:12: cannot find symbol
symbol: class WebSecurityConfigurerAdapter
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                                       ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:11: cannot find symbol
symbol: class EnableWebMvcSecurity
@EnableWebMvcSecurity
 ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:14: cannot find symbol
symbol  : class HttpSecurity
location: class hello.WebSecurityConfig
    protected void configure(HttpSecurity http) throws Exception {
                             ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:30: cannot find symbol
symbol  : class GlobalAuthenticationConfigurerAdapter
location: class hello.WebSecurityConfig
            GlobalAuthenticationConfigurerAdapter {
            ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:33: cannot find symbol
symbol  : class AuthenticationManagerBuilder
location: class hello.WebSecurityConfig.AuthenticationConfiguration
        public void init(AuthenticationManagerBuilder auth) throws Exception {
                         ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:13: method does not override or implement a metho
d from a supertype
    @Override
    ^
C:\Users\mbresciani\Desktop\Spring\Guide\Securing a Web Application\src\main\jav
a\hello\WebSecurityConfig.java:32: method does not override or implement a metho
d from a supertype
        @Override
        ^
12 errors
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 7.452 secs

is there something working in these tutorials?!?!

Works for me. Do you have a mouldy dependency cache? Anything in your ~/.gradle?

I solved the issue: used the downloaded gradle file instead of the modifications written in the guide page, as usual...

# HG changeset patch
# User Marco Bresciani
# Date 1409149141 -7200
#      Wed Aug 27 16:19:01 2014 +0200
# Node ID e1029a58d7b1ba2db6a70b549f8f27b16b806187
# Parent  c7c9866db2f5338b10c28beec053835706a92b68
Create a Gradle build file

diff -r c7c9866db2f5 -r e1029a58d7b1 build.gradle
--- a/build.gradle  Wed Aug 27 16:13:43 2014 +0200
+++ b/build.gradle  Wed Aug 27 16:19:01 2014 +0200
@@ -27,9 +27,10 @@

 dependencies {
     compile("org.springframework.boot:spring-boot-starter-thymeleaf")
+    compile("org.springframework.boot:spring-boot-starter-security")
     testCompile("junit:junit")
 }

 task wrapper(type: Wrapper) {
     gradleVersion = '1.11'
-}
\ No newline at end of file
+}

Thanks for the update. Fixed it for Gradle users in the docs.