I started a learning project to get familiar with Gradle, Spring and Vaadin. So far, I successfully created basic CRUD functionality with the help of some Spring guides.
Now I want to import the project into NetBeans. I installed the Gradle Support plugin for NetBeans and cloned my repository into a new NetBeans project.
When I try to build
or bootRun
the project within NetBeans, it fails, telling me that the main class cannot be found. But when I build
or bootRun
directly from the command line using the gradle wrapper I loaded into the repository, it works fine.
I studied every single page of the Gradle Support plugin's wiki on GitHub but couldn't find any information relevant to my problem.
Here's the output I get when trying to run the project in NetBeans via the project's context menu action Tasks/build/build:
Executing: gradle :build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':findMainClass'.
> Could not find property 'main' on task ':run'.
* 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: 1.957 secs
Build failure (see the Notifications window for stacktrace): gradle :build
I pasted the mentioned stacktrace to Gist.
And here's the output I get for the successful build executed from the command line on the very same project:
$ ./gradlew build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
BUILD SUCCESSFUL
Total time: 11.673 secs
I have really no idea how to go on with this and would greatly appreciate any hints and I find it very odd that I get different results when running from command line and when running from within NetBeans. Shouldn't the NetBeans plugin just be calling the same commands that I use directly on the command line and that work fine?