Maven 2.x Tomcat Plugin

Add context.xml support to tomcat:run

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-beta-1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    2

Description

Need to support context.xml for environment properties such as JNDI etc.

  1. MOJO-594.diff
    23/Jun/08 5:40 PM
    1 kB
    Paul Davis
  2. MOJO-594-1.diff
    25/Jun/08 4:48 PM
    3 kB
    Paul Davis

Activity

Hide
Matthew Payne added a comment -

Doesn't this already work.

You can put a context.xml file in /WEB-INF/META-INF

This works file for me.

Show
Matthew Payne added a comment - Doesn't this already work. You can put a context.xml file in /WEB-INF/META-INF This works file for me.
Hide
Ben Speiser added a comment -

In your asnwer, which of the following are you referring to?

Do you mean:

[webapp]/WEB-INF/context.xml
[webapp]/WEB-INF/META-INF/context.xml
[webapp]/META-INF/context.xml

...because this doesn't work for me either.

Show
Ben Speiser added a comment - In your asnwer, which of the following are you referring to? Do you mean: [webapp]/WEB-INF/context.xml [webapp]/WEB-INF/META-INF/context.xml [webapp]/META-INF/context.xml ...because this doesn't work for me either.
Hide
Paul Davis added a comment -

According to the docs:
http://mojo.codehaus.org/tomcat-maven-plugin/deployment.html

It should be here:
src/main/webapp/META-INF/context.xml

However, it fails to work with:
mvn tomcat:run

If I use:
mvn package
and deploy the war file to a standalone tomcat server. That works.

Looking in "target/tomcat/conf/" shows that the context file is not being deployed during the tomcat:run task.

Show
Paul Davis added a comment - According to the docs: http://mojo.codehaus.org/tomcat-maven-plugin/deployment.html It should be here: src/main/webapp/META-INF/context.xml However, it fails to work with: mvn tomcat:run If I use: mvn package and deploy the war file to a standalone tomcat server. That works. Looking in "target/tomcat/conf/" shows that the context file is not being deployed during the tomcat:run task.
Hide
Paul Davis added a comment - - edited

This patch adds support for using "context.xml".

Note: It only works when running "mvn tomcat:run-war"
It will not work for "mvn tomcat:run" unless "contextFile" is set in the pom configuration.

Show
Paul Davis added a comment - - edited This patch adds support for using "context.xml". Note: It only works when running "mvn tomcat:run-war" It will not work for "mvn tomcat:run" unless "contextFile" is set in the pom configuration.
Hide
Paul Davis added a comment -

Added documentation for the feature.
This patch should be used instead of the one I submitted earlier.

Show
Paul Davis added a comment - Added documentation for the feature. This patch should be used instead of the one I submitted earlier.
Hide
Mark Hobson added a comment -

Thanks for the patch, although I ended up implementing this by configuring the context directly. META-INF/context.xml is now picked up for both tomcat:run and tomcat:run-war.

Show
Mark Hobson added a comment - Thanks for the patch, although I ended up implementing this by configuring the context directly. META-INF/context.xml is now picked up for both tomcat:run and tomcat:run-war.
Hide
Hugo Palma added a comment -

Is there a way i can get a version of the plugin with this patch applied without having to compile ?

Show
Hugo Palma added a comment - Is there a way i can get a version of the plugin with this patch applied without having to compile ?
Hide
Mark Hobson added a comment -

I'd like to see another release of the plugin soon, but in the meantime I've deployed a snapshot:
http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-alpha-2-SNAPSHOT/

Show
Mark Hobson added a comment - I'd like to see another release of the plugin soon, but in the meantime I've deployed a snapshot: http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-alpha-2-SNAPSHOT/
Hide
Ronny Løvtangen added a comment -

The 1.0-alpha-2-SNAPSHOT version uses <artifactId> as context root, not <build><finalName> like earlier version.
So I first thought it didn't work..
But it did, and it picks up src/main/webapp/META-INF/context.xml without any additional configuration.
Finally able to run 'mvn tomcat:run' with a datasource

Show
Ronny Løvtangen added a comment - The 1.0-alpha-2-SNAPSHOT version uses <artifactId> as context root, not <build><finalName> like earlier version. So I first thought it didn't work.. But it did, and it picks up src/main/webapp/META-INF/context.xml without any additional configuration. Finally able to run 'mvn tomcat:run' with a datasource
Hide
Olivier Lamy added a comment -

reopen to set fixed version

Show
Olivier Lamy added a comment - reopen to set fixed version

People

Vote (5)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: