"Unable to find main class" with Maven on spring-boot project in Eclipse

You can try adding this in the properties section of your pom

<start-class>your.package.main</start-class>

You should have this

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

only in those modules that you want to run, but not in the parent pom.


Just for someone who faced with similar problem. I added spring-boot-maven-plugin in parent POM in section pluginManagement section like this:

 <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Then I added the plugin only in the modules using it (in plugin section).The project has been successfully built after that.