为什么scala编译器参数会传递给我的程序?
我的pom.xml中有以下内容:为什么scala编译器参数会传递给我的程序?,scala,maven,command-line-arguments,Scala,Maven,Command Line Arguments,我的pom.xml中有以下内容: <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <configuration> <scalaVersion>${scala.version}</scalaVersion> <args>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-unchecked</arg>
<arg>-deprecation</arg>
</args>
</configuration>
</plugin>
它会打印:
$ mvn scala:run -DaddArgs='hello|world'
[...]
-unchecked
-deprecation
hello
world
为什么??前两个是编译器参数(它们实际上是这样工作的),我不想在我的程序中看到它们
如何避免这种行为?如果要尝试使用sbt,请在项目根目录中使用一个简单的
build.sbt
:
name := "test"
version := "0.1-SNAPSHOT"
scalaVersion := "2.9.1"
然后你可以运行它
% xsbt
> run Hello World
...
Hello
World
看起来很奇怪。你应该考虑使用SBT来代替。@戴维,我试过了,但看起来并不简单,因为我想我会再发布一个关于SBT的问题。我在本页的最后一节发现了这个错误的方法:是的,我知道,谢谢。我在sbt方面的问题更深一些,涉及到库依赖性。Nevermind:)所以,最后我开始使用SBT,所以这个被接受了。谢谢
% xsbt
> run Hello World
...
Hello
World