IDEA打包JAR后,运行出现问题

报错:java.lang.IllegalArgumentException: No auto configuration classes found in META-
INF/spring.factories. If you are using a custom packaging, make sure that file i
s correct.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>true</fork>
        <mainClass>com.jxust.SpringbootdemoApplication</mainClass>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

写入pom.xml文件中,接着不使用IDEA自带的打包方法,改用在pom.xml文件目录下使用“mvn install”来打包,打包之后如果没报错就可以运行了,运行命令是在生成jar包的目录下使用“java -jar xxx.jar”来运行,接着打开浏览器就可以运行了。


版权声明:本文为webmater2320原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。