4

I am trying to use the scala-maven-plugin for one of my project. I get the following error when I run mvn package:

Failed to execute goal 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

Here is my pom.xml file:

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

I am a Mac user (using Terminal) and have Java and Maven installed.

Sina
  • 209
  • 1
  • 3
  • 11
  • 1
    In case you didn't notice, I updated my answer. The `-make:transitive` option is no longer accepted by the _Scala_ compiler and so that line should be removed from your configuration. Let me know if my answer worked for you... – Mike Allen May 10 '18 at 14:08

1 Answers1

3

That is a very old version of the plugin (dating to around 2010), and may not be compatible with recent Java & Scala releases. Incidentally, it has been renamed to the scala-maven-plugin and the latest release is 3.3.2:

<plugin>
  <groupId>net.alchim31.maven</groupId>
  <artifactId>scala-maven-plugin</artifactId>
  <version>3.3.2</version>
  <!-- etc. -->
</plugin>

Give that a try...

Also, I strongly recommend using SBT over Maven if you're primarily working with Scala (SBT handles combined Java and Scala builds too). It has a steeper learning curve than Maven, but is well worth the effort...

UPDATE

BTW, I should mention that -make:transitive is no longer accepted by the Scala compiler, so you should remove that line.

Mike Allen
  • 8,139
  • 2
  • 24
  • 46
  • Thanks very much, @MikeAllen. Actually, your response could solve a part of the problem. I have another error that I think is not related to this topic. – Sina May 10 '18 at 17:20