Friday 25 November 2016

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: Unable to find main class

Solutions: 


Solution 1 :

You needed to change the packaging parameter to jar from pom. Also, the repositories, pluginRepositories, the maven-compiler-plugin and the spring-boot-maven-plugin's version and executions weren't needed.


Solution 2: 

Try mvn install and see if it works


Solution 3:


Preview:
<properties>
    <!-- The main class to start by executing java -jar -->
    <start-class>com.mycorp.starter.HelloWorldApplication</start-class>
</properties>

Solution 4:

Enable the main() method in your Application.java.

Configure spring-boot-maven-plugin to specify the class with the main class (Spring should find it anyway if you have one, but good to be explicit):


Preview:
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring-boot-version}</version>
    <configuration>
        <mainClass>the.package.of.Application</mainClass>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

No comments:

Post a Comment

Spring boot with CORS

CORS (Cross-Origin Resource Sharing) errors occur when a web application running in a browser requests a resource from a different domain or...