本文主要是介绍在pom.xml添加scala-library包,使maven工程项目支持scala支持,不用在ide中进行配置添加scala库。,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、在pom.xml添加如下内容:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>scala_test</groupId><artifactId>scala_test</artifactId><version>1.0-SNAPSHOT</version>
<dependencies><dependency><groupId>org.scala-lang</groupId><artifactId>scala-library</artifactId><version>2.11.12</version></dependency>
</dependencies><build><sourceDirectory>src/main/java</sourceDirectory><testSourceDirectory>src/test/java</testSourceDirectory><plugins><plugin><groupId>org.scala-tools</groupId><artifactId>maven-scala-plugin</artifactId><version>2.15.2</version><executions><execution><goals><goal>compile</goal><goal>testCompile</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>3.1.1</version><configuration><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.10</version><configuration><skip>true</skip></configuration></plugin></plugins></build>
</project>
2、在pom.xml就不用在ide中进行配置添加scala库了、具体scala的包的版本可以通过在maven中搜索scala-library来找到对应的版本,如下图所示:
注意:要选择org.scala-lang对应的
3、然后选择scala对应的版本,如下图所示:
这篇关于在pom.xml添加scala-library包,使maven工程项目支持scala支持,不用在ide中进行配置添加scala库。的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!