使用maven scala插件,类似于以下配置的配置将适用于混合了Java和scala源代码的项目(当然,scala源代码位于/
scala目录中,正如其他人提到的那样)。
您可以运行run mvn compile,test等…,它们都将正常运行。非常好(它将首先自动运行scalac)。
对于一个出色的IDE,IntelliJ
8可以很好地工作:添加scala插件,然后添加一个scala小平面,然后调整scala的编译设置以首先运行scalac(如果您与scala和java源代码有循环依赖关系,则至关重要)。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>demo</groupId><artifactId>scala-java-app</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><name>scala-java-app</name><repositories> <repository> <id>scala-tools.org</id> <name>Scala-tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </repository></repositories><pluginRepositories> <pluginRepository> <id>scala-tools.org</id> <name>Scala-tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </pluginRepository></pluginRepositories><build> <plugins> <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <executions> <execution> <id>compile</id> <goals> <goal>compile</goal> </goals> <phase>compile</phase> </execution> <execution> <id>test-compile</id> <goals> <goal>testCompile</goal> </goals> <phase>test-compile</phase> </execution> <execution> <phase>process-resources</phase> <goals> <goal>compile</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build><dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.7.2</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency></dependencies>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)