When running my jar file: java -jar target/places-1.0-SNAPSHOT.jar
I'm getting the next error :
no main manifest attribute, in target/places-1.0-SNAPSHOT.jar
The pom.xml
contains the spring-boot-maven-plugin
:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.places.Main</mainClass>
</configuration>
</plugin>
I also tried to create a MANIFEST.MF
file and specifying the class, but it didnt help.
In addition, I also tried:
<properties>
<!-- The main class to start by executing "java -jar" -->
<start-class>com.places.Main</start-class>
</properties>
Main class:
@SpringBootApplication
public class Main {
public static void main(String[] args) throws InterruptedException {
SpringApplication.run(Main.class,args);
}
}
Any idea what else can I try?
Try adding repackage
goal to execution goals.
Otherwise you would need to call the plugin explicitly as mvn package spring-boot:repackage
.
With the goal added, you have to call only mvn package
.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.places.Main</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>