Bug Resolution: Unable to find main class
Bug Description
- IDE: IntelliJ IDEA 2021.3
- Language: Java
- Error: Unable to find main class
I have created a multi-module Spring Boot project that will serve as a tool library for other projects to use. When building the multi-module Spring Boot project, the IDE prompts the following error: Unable to find main class.
Solution
The plugin that comes with SpringBoot requires the main method.
1 | <plugin> |
Because this is a utility project, there is no main method, so you need to make the following changes to the parent's pom.xml:
1 | <plugin> |
![](/images/java-bug-2/build.png)
In a multi-module Springboot project, the child modules' pom.xml will inherit the configuration in the parent's pom.xml.