8

I like to develop using the tomcat7-maven-plugin, especially the mvn tomcat7:run / tomcat7:run-war goal in order to quickly test my app,

this plugin allows you to specify a custom Context.xml (which is very handy to provide stub for jndi datasources)

my issue is, I can not think of a good place to store this Context.xml. it simply does not fit well in the maven standard directory layout...

any idea ? best practices ? :D

thx,

gjambet
  • 369
  • 5
  • 13

2 Answers2

10

OK, I have not found a proper answer. In case someone wonders, I took this approach:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <configuration>
        <contextFile>${project.basedir}\src\tomcat7-maven-plugin\resources\context.xml</contextFile>
    </configuration>
</plugin>


Comments are welcome!

informatik01
  • 16,038
  • 10
  • 74
  • 104
gjambet
  • 369
  • 5
  • 13
  • 1
    This saved my day! I used `additionalConfigFilesDir` but I could not access them within autowired environment variable. With `contextFile `worked great. Thanks. – Evris Tzam Oct 02 '18 at 08:43
3

We use the tomcat7-maven-plugin for integration tests with maven-surefire-plugin. For this purpose we this path:

<contextFile>${project.basedir}/src/test/resources/context.xml</contextFile>  

If you run it only for testing this would fit.

Michael_S
  • 196
  • 2
  • 9
  • thx, i did not took this approach as i'm not really fond of mixing resources for unit testing (both locally and externally) and resources dedicated to runt a plugin for integration tests – gjambet Aug 11 '15 at 14:29