
[英]I can't run the script output by gradle build: "Could not find or load main class"
[英]Window startup script generated by Gradle can't find main class
我正在使用 Application gradle 插件来生成 zip 文件和 tar 球。 当我运行distZip
任务时,它成功生成了一个 zip 文件,其中包含所需的启动脚本和库。
The generated Linux startup script works fine (executing the xyz
shell script) using the Windows Linux Subsystem (Ubuntu).
$ ./xyz--help
<help output>
但是,生成的 Windows xyz.bat file
会引发以下错误(PowerShell):
.\xyz.bat --help
Error: Could not find or load main class com.myapp.xyz.Main
这是我的 build.gradle:
plugins {
id 'java'
id 'application'
}
group 'com.myapp'
version '1.0'
repositories {
mavenCentral()
}
dependencies {
// ..
}
test {
useJUnitPlatform()
}
jar {
manifest {
attributes 'Main-Class': 'com.myapp.xyz.Main'
}
}
application {
mainClass = 'com.myapp.xyz.Main'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.