【问题标题】:maven-scala-plugin giving pom file errormaven-scala-plugin 给出 pom 文件错误
【发布时间】:2012-11-16 12:05:30
【问题描述】:

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

        <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>

这是错误:

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

我是否正确配置了 pom?

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

当我查看项目的 Maven 属性时,生命周期映射不可用:

【问题讨论】:

    标签: eclipse scala maven maven-plugin m2eclipse


    【解决方案1】:

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

    查看此文档:

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

    【讨论】:

    • 安装正确的连接器比忽略目标要好。这样可以避免 Maven 构建给出与 Eclipse 构建不同的结果。
    【解决方案2】:

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

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

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

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

    【讨论】:

    • 从阅读文档看来“执行:scala-test-compile,阶段:test-compile”没有到任何映射元数据源的生命周期映射。所以看来我可以忽略这个错误。这个对吗 ?请参阅问题编辑
    • 这些建议都不令人满意---第一个没有找到连接器;第二个导致你的 scala 文件没有在 Eclipse 中构建。
    • @JoshHansen "您也可以将添加部分中的 替换为 以在 Eclipse 中运行目标。"
    • @JoshHansen 另见 user2635460 的回答,现在有一个连接器。
    【解决方案3】:

    在eclipse中安装m2e插件(Maven Integration for Scala IDE),效果很好。

    【讨论】:

      猜你喜欢
      • 2015-12-21
      • 2013-09-15
      • 2011-11-29
      • 1970-01-01
      • 2018-02-01
      • 1970-01-01
      • 2016-09-17
      • 2020-09-17
      • 2018-12-25
      相关资源
      最近更新 更多