Gradle on the Spring MVC tutorial


(J D) #1

I had downloaded the source code from the Spring site - http://spring.io/guides/gs/serving-web-content/

I get the following exception when I run the build. Did I miss any configuration…

D:\SpringMVC\SpringMVCWeb>gradlew build Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

D:\SpringMVC\SpringMVCWeb>gradle build --debug … Finished executing task ‘:repackage’ 05:43:05.067 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :repackage FAILED 05:43:05.090 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :repackage (Thread[main,5,main]) completed. Took 0.516 secs. 05:43:05.108 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 1.888 secs, idle: 0.671 secs 05:43:05.195 [ERROR] [org.gradle.BuildExceptionReporter] 05:43:05.215 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 05:43:05.243 [ERROR] [org.gradle.BuildExceptionReporter] 05:43:05.260 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 05:43:05.277 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ‘:repackage’. 05:43:05.414 [ERROR] [org.gradle.BuildExceptionReporter] > Unable to find main class 05:43:05.435 [ERROR] [org.gradle.BuildExceptionReporter] 05:43:05.452 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 05:43:05.471 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:repackage’. 05:43:05.486 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActi onsTaskExecuter.java:69) 05:43:05.502 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTask Executer.java:46) 05:43:05.660 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecuti onAnalysisTaskExecuter.java:35) 05:43:05.681 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExec uter.java:64) 05:43:05.701 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter .java:58) 05:43:05.719 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySou rceFilesTaskExecuter.java:42) 05:43:05.745 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoA ctionsExecuter.java:52) 05:43:05.765 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter .java:53) 05:43:05.781 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOn ceTaskExecuter.java:43)


(Peter Niederwieser) #2

What exactly did you do? Cd into the ‘complete’ subdirectory and run ‘gradlew build’? That works fine for me.


(J D) #3

I don’t have a complete folder. I am able to run gradle but gradlew doesn’t work for me and throws the exception that I had posted earlier.

I have also attached an image of my project structure.