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>
Similar Posts:
- No main manifest attribute when running Java – jar
- Maven no main manifest attribute when generate jar for project
- Run jar file under Linux system, prompt: no main manifest attribute, in xxx.jar [How to Solve]
- Maven warnning: ‘build.plugins.plugin.version’ is missing [How to Solve]
- [Solved] Spring Boot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0
- [Solved] SpringBoot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-res
- [Solved] Dynamic Web Module 3.0 requires Java 1.6 or newer
- Solve the error in Maven project packaging: error injecting constructor
- [Solved] Spring Start Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project gulimall-coupon: There are test failures. Please refer to D:\m1\0613\mall-coup
- Automatic version change of IntelliJ idea language level and Java compiler