运行 Maven 包目标时
mvn 清洁包
构建抛出错误:
目标 org.springframework.boot:spring-boot-maven-plugin:3.0.0-M1:repackage failed: 无法在插件 'org.springframework.boot:spring-boot-maven-plugin 中加载 mojo 'repackage': 3.0.0-M1' 由于 API 不兼容:org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/RepackageMojo 已由 Java 运行时的更新版本(类文件61.0 版),此版本的 Java 运行时仅识别最高 52.0 的类文件版本
我的 JAVA_HOME 指向 jdk1.8.0_73
如何让 spring-boot-maven-plugin 以重新打包目标运行?
下面是我模块中的 Maven 构建配置。
<build>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<webResources>
<resource>
<directory>src/main/resources</directory>
<include>*.*</include>
<targetPath>/WEB-INF/classes</targetPath>
</resource>
<resource>
<directory>src/main/webapp/errors</directory>
<include>*.*</include>
<targetPath>/errors/</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.services.MyAApp</mainClass>
<layout>war</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>