intellj IDEA无法正确构建jar [英] intellj IDEA doesnt build jar properly
问题描述
我遵循了
我保留了默认选项
使用intellij版本进行测试
不起作用
不起作用
使用Spring Boot中提供的内部版本进行测试
有效
I followed this "tutorial" to build a jar from a project in intellj. The project includes a small spring application, that works running from intellij itself.
If I build the jar and run it from the command line, it says "Error: Could not find or load main class". If I run the main.class file using java .\main.class
, the same Message shows up.
I specified the Main class in Intellij-IDEA before building the Jar, and the Main.java file looks something like this:
@SpringBootApplication
@RestController
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
@GetMapping("/index")
public String index() {
. . . .
}
}
I performed some test
So I created a new project
I left the default options
test with the intellij build
not work
not work
test with the build provided in spring boot
it works
这篇关于intellj IDEA无法正确构建jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!