eclipse maven-scala-plugin 给出 pom 文件错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13416264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:25:04  来源:igfitidea点击:

maven-scala-plugin giving pom file error

eclipsescalamavenmaven-pluginm2eclipse

提问by blue-sky

I'm testing java code using scala and maven. The maven-scala-plugin is returning a pom file error in Eclipse. Here is my pom snippet :

我正在使用 scala 和 maven 测试 java 代码。maven-scala-plugin 在 Eclipse 中返回一个 pom 文件错误。这是我的 pom 片段:

        <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <version>2.15.2</version>
            <executions>
                <execution>
                    <id>scala-test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

This is the error :

这是错误:

Plugin execution not covered by lifecycle configuration: org.scala-tools:maven-scala-plugin:2.15.2:testCompile 
 (execution: scala-test-compile, phase: test-compile)

Have I configured the pom correctly ?

我是否正确配置了 pom?

The scala tests are running correctly, in that they are all passing. Perhaps this is a Maven bug ?

scala 测试运行正确,因为它们都通过了。也许这是一个 Maven 错误?

When I view maven properties for the project the lifecycle mappings are not available : enter image description here

当我查看项目的 Maven 属性时,生命周期映射不可用: 在此处输入图片说明

采纳答案by Alexey Romanov

No, this is not a Maven bug. This pagedescribes why the message is shown and how to deal with it.

不,这不是 Maven 错误。此页面描述了为什么显示该消息以及如何处理它。

After pressing Ctrl+1 over the problem Eclipse should suggest two quick fixes:

在问题上按 Ctrl+1 后 Eclipse 应该建议两个快速修复:

  1. Discover new m2e connectors. Try this first, if it finds a connector restart Eclipse and rebuild the project, the problem should go away.

  2. Permanently mark goal as ignored. It will add some code in pom.xmlwhich means the goal won't be run on builds within Eclipse, only from command line. You can also replace <ignore>in the added part with <execute>to run the goal in Eclipse as well.

  1. 发现新的 m2e 连接器。先试试这个,如果发现连接器重新启动 Eclipse 并重建项目,问题应该会消失。

  2. 将目标永久标记为忽略。它将添加一些代码,pom.xml这意味着目标不会在 Eclipse 中的构建上运行,只能从命令行运行。您也可以<ignore>将添加的部分替换<execute>为在 Eclipse 中运行目标。

回答by user2635460

You should instal m2eclipse-connector from this update site: http://alchim31.free.fr/m2e-scala/update-site

您应该从此更新站点安装 m2eclipse-connector:http: //alchim31.free.fr/m2e-scala/update-site

Check this documentation:

检查此文档:

http://scala-ide.org/docs/tutorials/m2eclipse/index.html

http://scala-ide.org/docs/tutorials/m2eclipse/index.html

回答by Kulan

Post installation of m2e plugin (Maven Integration for Scala IDE) in eclipse, it worked well.

在 Eclipse 中安装 m2e 插件(Scala IDE 的 Maven 集成)后,效果很好。