首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >避免Eclipse忽略Scala项目中的垃圾

避免Eclipse忽略Scala项目中的垃圾
EN

Stack Overflow用户
提问于 2012-12-21 18:20:04
回答 1查看 2.7K关注 0票数 2

我发现让maven使用mvn在命令行上编译scala源代码的唯一方法是在scala-maven-plugin中显式地添加执行。

代码语言:javascript
复制
  <plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>3.0.1</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
          <goal>testCompile</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <args>
        <arg>-deprecation</arg>
        <arg>-unchecked</arg>
      </args>
      <jvmArgs>
        <jvmArg>-Xms128m</jvmArg>
        <jvmArg>-Xmx1024m</jvmArg>
      </jvmArgs>
    </configuration>
  </plugin>

但是,Eclipse不喜欢这些执行,并给出以下错误。

生命周期配置未涵盖的插件执行: net.alchim31.maven:scala-maven-plugin:3.0.1:compile (执行:默认,阶段:编译) 生命周期配置未涵盖的插件执行: net.alchim31.maven:scala-maven-plugin:3.0.1:testCompile (执行:默认,阶段:测试编译)

Eclipse建议将目标永久标记为被忽略,但这意味着大量丑陋的垃圾被添加到我的pom中。我是说,XML已经很难看了。是否有更好的方法来配置我的项目来用mvn编译源代码?下面是Eclipse添加的内容。

代码语言:javascript
复制
<pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        net.alchim31.maven
                                    </groupId>
                                    <artifactId>
                                        scala-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [3.0.1,)
                                    </versionRange>
                                    <goals>
                                        <goal>testCompile</goal>
                                        <goal>compile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-22 02:19:36

m2e要求您安装特定的m2e插件。scala plugin的版本是m2e-scala:https://github.com/sonatype/m2eclipse-scala

删除禁用scala plugin的pluginManagement,并安装m2e-scala http://alchim31.free.fr/m2e-scala/update-site

顺便说一下,最新的插件是3.1.0,而不是3.0.1。

干杯,

斯特凡纳

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13995236

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档