scala-maven-plugin: Run script in execution doesn't work

I just read in the Maven Handbook (http://www.sonatype.com/books/mcookbook/reference/sect-scala-script-inline.html) that it’s possible to run a scala script inside the Maven Scala Plugin. I tried the example in the book, which doesn’t work. Altering the script to a hello world also doesn’t work. Tried different versions of Scala (Scala 2.7.0, Scala 2.7.3, Scala 2.8.RC2) and different versions of the Maven Scala Plugin. But i always get the following error to run any script inside the MSP: java.lang.NoClassDefFoundError: scala/ScalaObject

Steps to reproduce: create scala maven project from archetype 1.2, add the following execution to the executions-tag of the maven scala plugin:

<execution>
  <id>prepare-package</id>
  <phase>prepare-package</phase>
  <goals>
    <goal>script</goal>
  </goals>
  <configuration>
    <scalaVersion>${scala.version}</scalaVersion>
    <keepGeneratedScript>true</keepGeneratedScript>
    <script>
    <![CDATA[
      println("hello from scala script")
    ]]>
    </script>
  </configuration>
</execution>

Then, run “mvn prepare-package” from command line.

About this issue

  • Original URL
  • State: closed
  • Created 14 years ago
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

For the record, we use the script goal extensively and it works. Can this issue be closed?