栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Maven构建一个Scala应用程序(混合了Java源代码)

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Maven构建一个Scala应用程序(混合了Java源代码)

使用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>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/494931.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号