Eclipse插件无法处理Maven工具链插件

时间:2017-09-20 11:01:21

标签: eclipse maven m2eclipse m2e

当我在我的pom.xml中有Maven工具链插件时:

Cannot find matching toolchain definitions for the following toolchain types:
jdk [ vendor='oracle' version='1.8' ]
Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file. (org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain:default:validate)

org.apache.maven.plugin.MojoFailureException: Cannot find matching toolchain definitions for the following toolchain types:
jdk [ vendor='oracle' version='1.8' ]
Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.
    at org.apache.maven.plugin.toolchain.ToolchainMojo.execute(ToolchainMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
    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:172)
    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:115)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    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:105)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
    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:86)
    at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

我在“c:\ user \ name \ .m2”文件夹中有“toolchains.xml”,其中包含Orcale 1.8 JDK的定义,Maven在命令行中工作正常,但Eclipse(Neon和Oxygen)报告以下内容错误:

<plugin>
    <groupId>org.eclipse.m2e</groupId>
    <artifactId>lifecycle-mapping</artifactId>
    <version>${m2e.lifecycle-mapping.version}</version>
    <configuration>
        <lifecycleMappingMetadata>
            <pluginExecutions>
                <pluginExecution>
                    <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-toolchains-plugin</artifactId>
                        <versionRange>[0.0.0,)</versionRange>
                        <goals>
                            <goal>toolchain</goal>
                        </goals>
                    </pluginExecutionFilter>
                    <action>
                        <ignore/> <!-- Changed from execute to ignore -->
                    </action>
                </pluginExecution>
            </pluginExecutions>
        </lifecycleMappingMetadata>
    </configuration>
</plugin>

编辑:我发现奇怪的事情,如果我将生命周期映射中的“操作”从“执行”更改为“忽略”,那么错误将从Eclipse中消失:

jQuery('.custom_field_name').keyup(function () { 
           var v = this.value.replace(' ','_');
           var vee = v.toLowerCase().replace(/\W/,'');
           if (vee!=this.value) this.value = vee;
});

但是,这不仅仅意味着Eclipse / m2e现在忽略了工具链吗?是否还需要其他一些配置/更改才能使其正常工作?

0 个答案:

没有答案