Gradle并尝试构建一个简单的Java项目。以下作品:
java -classpath build/libs/Arverne-1.0.jar arverne.ArverneMain
[!] Arverne starting up ...
但是,尝试从gradle执行“run”命令失败:
gradle run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Error: Could not find or load main class src.main.java.arverne.ArverneMain
:run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* 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: 5.134 secs
目录结构是:
.
├── Arverne.iml
├── arverne.properties
├── build
│ ├── classes
│ │ └── main
│ │ └── arverne
│ │ └── ArverneMain.class
│ ├── dependency-cache
│ ├── libs
│ │ └── Arverne-1.0.jar
│ └── tmp
│ └── jar
│ └── MANIFEST.MF
├── build.gradle
├── build.gradle~
├── out
│ └── production
│ └── Arverne
│ └── arverne
│ └── ArverneMain.class
└── src
└── main
└── java
└── arverne
└── ArverneMain.java
16 directories, 9 files
最后,类的实现是:
package arverne;
public class ArverneMain {
public static void main(String[] args) {
System.out.println("[!] Arverne starting up ...");
}
}
非常感谢任何帮助!