Syntax Highlighter CSS (shCore.css)

Syntax Highlighter CSS (shThemeDefault.css)

Syntax Highlighter JS (shCore.js)

Syntax Highlighter JS (shAutoloader)

Highlight CSS (default.css)

Highlight JS (highlight.pack.js)

Syntax Highlighter CSS (custom.css)

Sunday, February 17, 2008

Maven + Scala + TestNG + Netbeans

There are lots of articles on the web on how to set up Maven with Scala, or TestNG and Scala, or Netbeans with Scala, but there aren't any resources that tell you how to tie them all together. The cursed Maven pom is a mystery, but I've managed to unearth the ancient hieroglyphs in the exact sequence that will make Maven, TestNG, and Scala work well together.

If you want to use all three along with an IDE, I hear jEdit is somewhat popular for Scala users, but I'm somewhat invested in Netbeans myself.


Blast all these IDEs to hell! I've had my last straw and I'm sticking with vim! The syntax highlighting is better with jEdit and its a little more stable, but Netbeans has a cleaner, more familiar interface (in my opinion). Stability is only a problem because you have to use the dev version of Netbeans to get the Scala plugins working. Anywho, once you get your editor/IDE set up, you'll want to know exactly what type in your pom to make everything work correctly.

If you follow the links for setting up Maven and Scala, your pom will look somewhat correct, you'll need to add the TestNG dependency:


Now, if you try to compile a TestNG test, you'll get compiler warnings about annotations. Make sure the target VM is set for 1.5 with the maven-scala-plugin:


By default, the 2.3 version of the maven-surefire-plugin is pulled in, but you'll want 2.4. Additionally, you'll want to add some information so surefire will find the tests you want to run:


Now if you have a test that looks like this:

import org.testng.annotations._

class MyCoolTest {
  def testConsole = {
    Console println "Hi!"
}'ll get a nice, satisfying result:

 T E S T S
Running TestSuite
[Parser] Running:
  Command line suite

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.411 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
Post a Comment