java - Maven modules and Spring test resources -


i have maven project made of several modules. of modules depend on other modules example module c <- module b <- module a. module c depends on module b depends on module a.

in each module, have spring config files in main/resources , test/resources, under test unit testing, while under main release/production. each config file self contained - module b contained spring config (file names foo-b.xml, foo-a.xml)

however, when need test module c, need reference module b's spring config under test/resources, included module b's main/resources config file. presents problem because production file has references jndi datasources test 1 not.

how can maven or spring reference test configuration file module dependency?

maven separates source classes & resources test classes & resources. may configure module b create test jar using maven-jar-plugin test-jar goal. then, may have module c reference module b's test code dependency.

<dependency>     <groupid>com.mycompany</groupid>     <artifactid>moduleb</artifactid>     <version>${project.version}</version>     <classifier>tests</classifier>     <scope>test</scope> </dependency> 

alternately, can create regular maven project including test code you'd share, include test dependency needed. idea described in maven jar plugin's usage docs.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -