简体   繁体   English

在eclipse中为“ maven-scala-plugin”设置Maven插件连接器

[英]Set up maven plugin connectors in eclipse for “maven-scala-plugin”

I'm importing an existing Maven project for Scala. 我正在为Scala导入现有的Maven项目。 I'm prompted by Eclipse to "Set up maven plugin connectors" for the plugin "maven-scala-plugin" version 2.13.1 but two goals are highlighted red with no optons support available to select. Eclipse提示我为插件“ maven-scala-plugin” 2.13.1版“设置maven插件连接器”,但是红色突出显示了两个目标,没有可选的opton支持。

What plugins are available to support the compile and testCompile goals? 哪些插件可用于支持compile和testCompile目标?

Eclipse is 3.7.2, but I'm not wedded to this version. Eclipse是3.7.2,但我不喜欢这个版本。

You don't need to support the compile and testCompile goals, the compilation is done by scala-ide. 您不需要支持compile和testCompile目标,编译是由scala-ide完成的。 You need to add the following mess to your pom.xml: 您需要将以下混乱添加到pom.xml中:

<pluginManagement>
  <plugins>
    <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.1.0,)</versionRange>
                <goals>
                  <goal>add-source</goal>
                  <goal>compile</goal>
                  <goal>testCompile</goal>
                  <goal>doc</goal>
                  <goal>doc-jar</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <ignore />
              </action>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

This tells your m2e (the maven plugin for eclipse) to ignore the goals which apply to your scala-maven-plugin . 这告诉您m2e(eclipse的maven插件)忽略适用于scala-maven-plugin You'll have to change the groupId & versionRange as well. 您还必须更改groupIdversionRange

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

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