irstv/orbisgis — pull request #46 by gourlaysama (2012-07-10 08:42:21+00:00)
Title: Add support for building gdms with SBT

This change adds the necessary files to build gdms using SBT and to keep a nice interaction between SBT, maven and Netbeans.

This folllowing scenario becomes possible:
1. launch ```sbt``` and ```compile``` (and ```test:compile```). It correctly uses the local maven repo and/or the IRSTV repo to get dependencies,
2. let the incremental compiler running (```~compile```),
3. change some Scala/Java code; the incremental compiler compiles it and any invalidated sources (this usually takes ~2 secs)
4. run some test from either maven or Netbeans directly, the tests run with the newly compiled classes
5. iterate 3 and 4 until the test passes, etc.

* This allows an iteration (change the sources, build, run a test) to take a few secondes instead of 1 min 30 with maven.
* This does not pollute the maven build: the ```pom.xml``` is not changed, and when maven is asked to build, it replaces whatever SBT has built.
* This does not change anything for Netbeans: the project is still a maven project, sources are still there, dependencies as well, it just ignores SBT.

The trick is to configure SBT to place its classes in the same place maven does:
* maven does not know they are already there when building, so it builds as if SBT did not exist (no conflicts of any kind),
* maven does not build anything when ask to exec:exec or surefire:test, it just runs the classes, and since SBT puts the classes there, maven uses them without problem,
* Netbeans uses maven to run a full test class (so no problem), and uses a custom Ant runner to run a single test. This runner extracts the correct classpath (which contains the sbt-built classes) and thus it works as well.

It is still not perfect, some mixed maven/sbt scenarios do not work and one cannot start the JUnit tests from SBT, but with this we are not far from having our cake and eat it :-)

cc @agueganno