Maven error no main manifest attribute

Maven error message “no main manifest attribute”.

This means that the maven program can’t find the program entry point. This usually happens when your main program is located in a Java package or the class name of the main program is different from the <name> property in pom.xml

Solution

We can specify the program entry point in pom.xml

<build>
 <plugins>
     <plugin> 

         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <version>3.1.0</version>
				
         <configuration>
             <archive>
                 <manifest>

                     <!-- Full qualified name of the main class-->
                     <mainClass>com.abc.Demo</mainClass>

                 </manifest>
             </archive>
         </configuration>
    </plugin>
 </plugins>
</build>

oliver

Leave a Reply

Your email address will not be published.