An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin

The command line runs the packaged jar package:

[email protected] simple-webservice-server % java -jar target/sample-1.0-SNAPSHOT.jar 7896
target/sample-1.0-SNAPSHOT.jar There is no master list property in the

Error reason: there is no manifest file in the packaged jar package, which has two lines of configuration, about the full path of the startup class of jar package 0

Add Maven plugin

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<version>3.0.2</version>
	<configuration>
		 <archive>
		  <manifest>
			   <addClasspath>true</addClasspath>
			   <classpathPrefix>lib/</classpathPrefix>
			   <mainClass>com.coffee.bee.Main</mainClass>
		  </manifest>
		 </archive>
	</configuration>
</plugin>

Plugins
pluginManagement > plugins


Read More: