我发现让maven使用mvn在命令行上编译scala源代码的唯一方法是在scala-maven-plugin中显式地添加执行。
<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添加的内容。
<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>发布于 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。
干杯,
斯特凡纳
https://stackoverflow.com/questions/13995236
复制相似问题