简体   繁体   中英

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

I'm importing an existing Maven project for Scala. 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.

What plugins are available to support the compile and testCompile goals?

Eclipse is 3.7.2, but I'm not wedded to this version.

You don't need to support the compile and testCompile goals, the compilation is done by scala-ide. You need to add the following mess to your 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 . You'll have to change the groupId & versionRange as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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