SpringBoot 运行jar包时提示no main manifest attribute解决方法
遇到的问题情况不同,不一定能解决您的问题。
方法1
java -cp helloworld.jar com.xxx.Application
将包含springboot的main方法的类指定,但是该方法未解决我的问题。
说明:通过IDEA启动springboot项目的时候,很显然便是采用的指定Application的方式
 
方法2
在pom文件内填写
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
 
方法 2 的补充
如果上述列出的 pom 文件没有解决,请尝试补充如下信息,主要是需要添加启动类
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includeSystemScope>true</includeSystemScope>
                <mainClass>这里填写你的 Application 的路径</mainClass>
            </configuration>
        </plugin>
    </plugins>
 </build>
 
问题完美解决。
                    
                
                
            
        
浙公网安备 33010602011771号