如何在使用maven的intelliJ中向Java项目添加scala依赖项
我想在纯Java项目中使用scala依赖项。没有必要在我的项目中编写scala,但当然我必须使用scala项目中定义的类/etc,我将其添加为依赖项。希望在IntellijMaven项目中执行此操作
我的pom如下所示:
<?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>com.xxx</groupId>
<artifactId>xxxx</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>group ID</groupId>
<artifactId>scala dependancy</artifactId>
</dependency>
</dependencies>
</project>
虽然我在pom中没有看到任何错误,但intellij无法导入scala库中定义的包。基本上它找不到它们
我做错了什么
# 1 楼答案
可以通过向pom添加以下依赖项来实现。xml文件:
更多信息请查看this