java - Scala-maven-plugin 无法执行
问题描述
我正在尝试将 scala-maven-plugin 用于我的一个项目。运行时出现以下错误mvn package
:
无法执行目标 org.scala-tools:maven-scala-plugin:2.15.0:compile (default) on project test_pro: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1
这是我的 pom.xml 文件:
<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">
....
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
....
</plugins>
</build>
</project>
我是 Mac 用户(使用终端)并安装了 Java 和 Maven。
解决方案
这是插件的一个非常旧的版本(可以追溯到 2010 年左右),可能与最近的Java和Scala版本不兼容。顺便说一句,它已重命名为 ,scala-maven-plugin
最新版本是 3.3.2:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.2</version>
<!-- etc. -->
</plugin>
试一试...
此外,如果您主要使用Scala(SBT也处理Java和Scala的组合构建),我强烈建议您在Maven上使用SBT 。它的学习曲线比Maven更陡峭,但值得付出努力......
更新
顺便说一句,我应该提到Scala-make:transitive
编译器不再接受它,因此您应该删除该行。
推荐阅读
- javascript - 在 JS 中,我无法将 HTML 放入 div
- ruby-on-rails - 缓存控制标头被忽略
- c# - 流畅地从一个窗口切换到另一个窗口
- javascript - 在 2 socket.on(event) 上获取不同的套接字 id
- javascript - Javascript - 平方距离表现不佳,为什么?
- flutter - 将 SingleChildScrollView 放在 Column 上方时不起作用
- python - 如何使用 Scopus API 和 Python 搜索特定期刊 ISSN 的所有作者、隶属关系和引文?
- node.js - Mongodb:如果在第一个集合中找不到数据,则在另一个集合中查找
- java - Java 套接字客户端不会停止读取数据
- python - 如何将字典列表(在 json 中)转换为 python 中的对象?