简体   繁体   English

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

[英]maven-scala-plugin giving pom file error

I'm testing java code using scala and maven. 我正在使用scala和maven测试java代码。 The maven-scala-plugin is returning a pom file error in Eclipse. maven-scala-plugin在Eclipse中返回一个pom文件错误。 Here is my pom snippet : 这是我的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. scala测试运行正常,因为它们都在通过。 Perhaps this is a Maven bug ? 也许这是一个Maven bug?

When I view maven properties for the project the lifecycle mappings are not available : 当我查看项目的maven属性时,生命周期映射不可用: 在此输入图像描述

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

No, this is not a Maven bug. 不,这不是Maven的错误。 This page describes why the message is shown and how to deal with it. 此页面描述了显示消息的原因以及如何处理消息。

After pressing Ctrl+1 over the problem Eclipse should suggest two quick fixes: 按Ctrl + 1完成问题之后Eclipse应该建议两个快速修复:

  1. Discover new m2e connectors. 发现新的m2e连接器。 Try this first, if it finds a connector restart Eclipse and rebuild the project, the problem should go away. 首先尝试这个,如果它找到连接器重新启动Eclipse并重建项目,问题应该消失。

  2. Permanently mark goal as ignored. 永久性地将目标标记为已忽略。 It will add some code in pom.xml which means the goal won't be run on builds within Eclipse, only from command line. 它将在pom.xml添加一些代码,这意味着目标不会在Eclipse中的构建上运行,只能从命令行运行。 You can also replace <ignore> in the added part with <execute> to run the goal in Eclipse as well. 您还可以使用<execute>替换添加部分中的<ignore>以在Eclipse中运行目标。

在eclipse中安装m2e插件(Maven Integration for Scala IDE)后,它运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM