springboot error
(1) maven.plugins:maven-compiler-plugin:3.8.0:compile failed missing: org/objectweb/asm/ClassVisitor
在使用 springboot 2.1.3 后,开始出现这个问题
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project model: Execution default-compile of goal org.apache.
maven.plugins:maven-compiler-plugin:3.8.0:compile failed: Unable to load the mojo 'compile' in the plugin 'org.apache.maven.plugins:maven-compiler-plugin:3.8.0'. A required class is
missing: org/objectweb/asm/ClassVisitor
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ ---
[WARNING] Error injecting: org.apache.maven.plugin.compiler.CompilerMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at org.codehaus.plexus.languages.java.jpms.LocationManager.<init>(Unknown Source)
maven-compiler-plugin 版本问题,指定版本
方法一,在pluginManagement指定
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
方法二,在每个模块里手动指定
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<classifier>exec</classifier>
</configuration>
</plugin>
</plugins>
</build>