【发布时间】:2020-08-06 10:21:28
【问题描述】:
我想在纯 Java 项目中使用 scala 依赖项。无需在我的项目中编写 scala,但当然我将不得不使用在我添加为依赖项的 scala 项目中定义的类/等。想在 intelliJ maven 项目中执行此操作。
我的 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 库中定义的包。本质上它找不到它们。
我在这里做错了什么?
【问题讨论】:
-
我不确定你到底需要什么(我不使用 Scala),但它可能看起来像这样:
<groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.13.1</version>(参见mvnrepository.com/artifact/org.scala-lang/scala-library)
标签: java scala intellij-idea