使用maven-scala-plugin 2.15.2
,我试图将 Scala 类文件的最大长度指定为“50”个字符。我尝试了 2 个地方pom.xml
:
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile-first</id>
<goals>
<goal>compile</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<scalacArgs> <-- Attempt #1 -->
<scalacArg>-Xmax-classfile-name 50</scalacArg>
</scalacArgs>
<scalaVersion>${scalaVer}</scalaVersion>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
<!-- Attempt #2 -->
</args>
</configuration>
我也跑了mvn compile -Xmax-classfile-name 50
,但 Maven 无法识别该选项并失败。
我可以在哪里使用maven-scala-plugin
?
您在哪里使用args
inside configuration
应该是你放置编译器参数的地方。您似乎还创建了scalacArgs
,但是args
被传递给 scalac。
我在我的插件中使用它来将选项传递给编译器:
<configuration>
<args>
<arg>-g:vars</arg>
<arg>-Yrangepos</arg>
<arg>-P:scoverage:dataDir:${coverage.data.dir}</arg>
<arg>-Xmax-classfile-name</arg>
<arg>70</arg>
</args>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<compilerPlugins>
<compilerPlugin>
<groupId>org.scoverage</groupId>
<artifactId>scalac-scoverage-plugin_${scala.major}</artifactId>
<version>${scoverage-plugin.version}</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
http://scala-tools.org/mvnsites/maven-scala-plugin/example_compile.html#Compiler_Arguments
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)