I'm trying to run a very simple project using Gradle and running into the following error when using the gradlew run command
:
could not find or load main class 'hello.HelloWorld'
Here is my file structure:
SpringTest
-src
-hello
-HelloWorld.java
-Greeter.java
-build
-libs
-tmp
-gradle
-wrapper
-build.gradle
-gradlew
-gradlew.bat
I excluded the contents of the libs and tmp folders because I didn't think that would be relevant information for this issue, but I can add it in if need be.
Here is my build.gradle file:
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
mainClassName = 'hello/HelloWorld'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "joda-time:joda-time:2.2"
}
jar {
baseName = "gs-gradle"
version = "0.1.0"
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
Any idea on how to fix this issue? I've tried all sorts of things for the mainClassName attribute but nothing seems to work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…