spring-guides / gs-uploading-files

Uploading Files :: Learn how to build a Spring application that accepts multi-part file uploads.
http://spring.io/guides/gs/uploading-files/
Apache License 2.0
469 stars 503 forks source link

Gradle build doesn't work #3

Closed gregturn closed 10 years ago

gregturn commented 10 years ago

If you follow the guide and use maven, everything works fine. But if you try to build with gradle, you get this:

$ ./gradlew bootRun
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "mainClass" on "root project 'complete'", value: "hello.FileUploader".
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:bootRepackage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRepackage'.
> Unable to find a single main class from the following candidates [hello.Application, hello.FileUploader]

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

BUILD FAILED

It's also captured in the fact that our CI build is broken.

Something has changed regarding the spring-boot-gradle-plugin such that you can no longer specify which public static void main runs with gradleRun vs. run or via the executable jar.

@philwebb Can you look at the code underneath complete and perhaps offer either a suggestion or a PR to fix up the gradle build? Thanks.

dsyer commented 10 years ago

The Boot plugin has its own configuration extension for the main class. So this will work:

springBoot {
    mainClass = "hello.FileUploader"
}

I'll have a look at defaulting from the JavaExec value as well.

gregturn commented 10 years ago

Resolved via #5