You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marco Beelen <MB...@iprofs.nl> on 2006/12/29 15:05:59 UTC
Relative path for surefire testsof multi-module project
Hello,
I'm having trouble building a multi-module-project, for which the individual modules do get build and test properly.
Here's what I want:
I'm using maven 2.0.4 to build a multi-module-project with 4 modules. The modules are seperated according to the functional layers of my application: Model, Dao's, Services and a WebApp.
In order to test my classes in the dao-layer I created a HSQL-database located in /src/test/resources/hsql/databases and added a seperated database configuration-file in /src/test/resources so my DAO's can use the provided database during testing instead of a central development database in which the data isn't stable and therefore produces inreliable test-results.
In the tests I configure my DataSource like so:
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:file:src/test/resources/hsql/databases/commonConfigTest;shutdown=true
jdbc.username=sa
jdbc.password=
HSQL can use a relative path to determine the location of the database and so íf I run mvn surefire:test from inside the dao-module to proper database gets loaded and all my test are run without faillures.
When I try to build the entire project the tests fail, due to the fact the te relative path of the database is incorrect now. ( It's missing the module-name as the first directory ) Of course I could add the module name to the path in my jdbc.url, but this would cause the tests to fail when I run then from inside the module itself. ( Which I can't have since that is the way the test are run, when I run the test for within Eclipse.
Possible solutions I could think of:
1.
Alter my database.properties for the jdbc.url by a placeholder and then replace it after the resources:testResources with some full path.
2.
Change the build a little so the src of my module get copied to the parent-directory.
But neither seem really appealing to implement.
Does anybody have any suggestions how I can solve this problem?
With kind regards,
Marco Beelen
________________________________
IPROFS <http://www.iprofs.nl/>
Marco Beelen
Java-ontwikkelaar
Gebouw "De Houthof"
Claus Sluterweg 125 B.0
2012 WS Haarlem
M +31 (0)6 55 14 55 54
E mbeelen@iprofs.nl
www.iprofs.nl <http://www.iprofs.nl/>
T +31 (0)23 547 6369
F +31 (0)23 547 6370
________________________________
IPROFS WENST U EEN MEESTERLIJK 2007!