当我使用Maven Update Project时,我尝试将org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1
添加到我的springboot应用程序pom.xml
中,以自动生成prob的Java代码。
该错误有时会出现。如果我使用“ Maven更新项目”和“项目>清理...”,它将在某个时间消失。但是,它仍然在那里,我再也不能容忍了。
我遇到的错误:
Execution default of goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile failed: Unable to load the mojo 'compile' (or one of its required components) from the plugin 'org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1' (org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile:default:generate-sources)
org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile failed: Unable to load the mojo 'compile' (or one of its required components) from the plugin 'org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1'
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:156)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$7(MavenImpl.java:1342)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1341)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:173)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:116)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:106)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:201)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:833)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the mojo 'compile' (or one of its required components) from the plugin 'org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1'
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:553)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:124)
... 30 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.apache.maven.plugin.Mojo
roleHint: org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:519)
... 31 more
Caused by: java.util.NoSuchElementException
at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next(RealmFilteredBeans.java:118)
at org.eclipse.sisu.plexus.RealmFilteredBeans$FilteredItr.next(RealmFilteredBeans.java:1)
at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:76)
at org.eclipse.sisu.plexus.DefaultPlexusBeans$Itr.next(DefaultPlexusBeans.java:1)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
... 33 more
我的pom.xml的<build>
:
<build>
<plugins>
<plugin>
<!-- https://mvnrepository.com/artifact/kr.motd.maven/os-maven-plugin -->
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- https://www.xolstice.org/protobuf-maven-plugin/index.html -->
<!-- https://mvnrepository.com/artifact/org.xolstice.maven.plugins/protobuf-maven-plugin -->
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<extensions>true</extensions>
<configuration>
<!-- <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact> -->
<!-- https://www.xolstice.org/protobuf-maven-plugin/compile-mojo.html -->
<!-- 默认为: src/main/proto/xxx.proto -->
<!-- <protoSourceRoot>${project.basedir}/src/main/proto</protoSourceRoot> -->
<!-- 默认为: ${project.build.directory}/generated-sources/protobuf/java,会自动添加为source,因为使用默认即可 -->
<!-- <outputDirectory>${project.basedir}/src/main/java</outputDirectory> -->
<!-- 当 clearOutputDirectory = true 时,每次执行都会清楚 outputDirectory 指定的目录下的所有文件 -->
<!-- <clearOutputDirectory>false</clearOutputDirectory> -->
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
该错误发生在:
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>