Announcing 1.0-SNAPSHOT compatible Maven Plugin

6 views
Skip to first unread message

Jon-Anders Teigen

unread,
Sep 22, 2009, 3:26:38 PM9/22/09
to scalatest-users
Hi.

The scalatest-maven-plugin now works with 1.0-SNAPSHOT
This is a major rewrite from the previous version which was tightly
coupled with 0.9.5.

But beware, there are some breaking changes
* Due to 1.0-SNAPSHOT being easily embeddable, the new plugin code is
a lot simpler. The plugin now actually has 0 (yes, zero) dependencies
on scala and scalatest, so it should hopefully work fine with all
versions and combinations of scala and scalatest-1.0.* that scalatest
itself supports
* 0.9.5 is not embeddable in an easy way, so to keep the code clean,
the new 1.0-SNAPSHOT compatible version of the plugin DOES NOT work
with any of the 0.9.x releases (if you require 0.9.5 support, don't
worry, the code for that is still available in a separate branch)

The plugin supports all the features of scalatest I know of, and
demonstrations of how to use some of them can be found in the
integration test suite ( src/it )

A little tip: It might be smart to disable surefire if you use the
maven-scalatest-plugin. surefire will happily execute anything that
ends or starts with "Test", regardless of what traits you extends or
not. By disabling it you can name your suites whatever you want, and
not having to worry about surefire creating problems by executing
stuff. Again, example of this is in the integration-test-suite

One last thing. maven-surefire-plugin executes everthing in the same
jvm as maven. This is different from surefire which by default forks a
new jvm for your tests. Your tests are however executed in a separate
classloader, so its not all that bad.

The code can be found at http://github.com/teigen/maven-scalatest-plugin

thanks
Jon-Anders Teigen

Bill Venners

unread,
Sep 22, 2009, 4:27:41 PM9/22/09
to scalate...@googlegroups.com
Hi Jon,

Cool! Thanks very much for this work.

Say, how did you manage to create a ScalaTest plugin that doesn't have
a dependency on Scala or ScalaTest?

Bill
--
Bill Venners
Artima, Inc.
http://www.artima.com

Jon-Anders Teigen

unread,
Sep 22, 2009, 5:06:16 PM9/22/09
to scalate...@googlegroups.com
Well, not having a dependency is a bit unprecise, what I meant was no
compile-time-dependency.
There obviously is a dependency, but it exists only at runtime.

The users of the plugin will need to declare both scalatest and scala
as dependencies in their maven pom files.
(equivalent of putting the jars in your test-lib folder)
The plugin then creates a classloader from all the dependencies
accessible in the pom file and loads the class
"org.scalatest.tools.Runner" from that classloader.
At last it gets and invokes the "run" method from the Runner class
using reflection, and depending on the boolean result, either approves
or fails the build.

The dependency is more correctly defined as the class
"org.scalatest.tools.Runner" with the method "boolean run(String[])"
must be avaialble in the test-scope.

/j
Reply all
Reply to author
Forward
0 new messages