Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
Today, I want to package a jar to run on Linux. I found that using java – jar demo-1.0. Jar to run, an error was reported
no main manifest attribute, in demo-1.0.jar
Solution:
Add the following configuration to Maven’s POM. XML
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.sf.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>