- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Questions about Scala + Maven in a mixed multimodule Java 1.6 + scala project
Sun, 2011-01-30, 20:54
If this is the wrong place for these questions, please let me know
where else to go.
The goal: to first use Scala in test scope to run unit tests against
Java code. The Maven project is multimodule, with about 20 modues.
Some are web modules (type 'war').
I was able to get it to work but not in the way that was consistent
with the documentation at
at http://scala-tools.org/mvnsites/maven-scala-plugin/index.html .
The documentation there however is dated -- the timestamps on the web
pages are often old and refer to releases that are not the current one
First, the documentation there mentions adding scala-tools
repositories. But the plugin is on maven central now. It works fine
without adding those.
I want to confirm that what else I am doing is correct.
I added src/main/scala and src/test/scala. I put my
"TestScalaTest.scala" class underneath src/test/scala .
I have added this to the project plugins:
It does not work if I do not specify executions for the compiler, are
there no default goals/phases for the plugin?
Next, I had to add the scala-library dependency. This makes sense,
but isn't well documented -- http://scala-tools.org/mvnsites/maven-scala-plugin/usage.html
doesn't mention it.
Is there anything else the documentation is missing?
If I want to add non-test code, I can add a 'complie' goal to the
compile phase in the plugin, and change the scope of scala-library
from test to compile. But what if I need to access scala classes from
Java? What else would be needed?