I have a quick question about getting spring to read a file from the application context that is external to the project. I have two projects; 1) Project A 2) Project Database. Project A has the following structure;
ProjectA
|-src
|-main
|-webapp
|-WEB-INF
|-config
|-spring
Project Database has the following structure:
Project Database
|-db
|-scripts
|-deltas
In the spring directory of Project A I have a dao-context file. In this I have configured an embedded database, however I want to initialize the database with scripts from project database. Specifically in from directory deltas.
I know the embedded database config should like the following:
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="someSchema.sql"/>
</jdbc:embedded-database>
However I am trying to determine the best way to reference the scripts in Project Database. In other words would should be the value of location if I want to use scripts in locations. A few details:
- Both projects would be checked out together on the same hierarchy.
- Furthermore this database would only be used to run the tests, not the actual production code. So what ever the solution it should be compatible with my build script when I run tests tasks.
- Lastly I want to avoid an absolute file path, because this will be run on multiple machines.
Any ideas?
Cheers
EDIT: Both projects are just folders and not jars. Neither projects are in each others classpath. Other than the fact that they are in the same directory there is no relation.
EDIT 2: Another scenario (and likely to happen) is that the db scripts could be in the same project as ProjectA , but not in the classpath. For example the directory structure could look like this:
ProjectA
|-db
|-scripts
|-deltas
|-src
|-main
|-webapp
|-WEB-INF
|-config
|-spring
If this was the case how would I access the scripts in the 'deltas' directory from the 'spring' directory?