You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Roberto C. Sánchez" <ro...@connexer.com> on 2014/09/02 15:24:14 UTC

Custom configuration for tomcat7:run goal

Greetings,

I have a maven-based project that I am working on. The project uses Spring. I have to implement a CORS filter, which requires some changes to the tomcat configuration.

For production deployments, I can edit the tomcat configuration on the server to make it do what I need. However, for development I would like to be able to make the tomcat7:run goal use a tweaked configuration. There is no web.xml stored in git, so maven is generating it and placing it in target/tomcat/conf/web.xml. I tried adding extra directives between the configuration tags for the tomcat7-maven-plugin. But that did not work.

My question is: how do I get the web.xml that maven generates include the extra directives that I need for the CORS filter to work when the project is launched from Eclipse or the command line using the tomcat7:run goal?

Regards,

-Roberto
-- 
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Custom configuration for tomcat7:run goal

Posted by Wayne Fay <wa...@gmail.com>.
> What I hoped to accomplish was to put some specific snippets in pom.xml
> or some other place and have maven pick up those snippets and drop them
> in the right place in the generated web.xml.

That plugin is owned and maintained by the Tomcat guys, so feel free
to file an improvement in their bug tracker and perhaps they'll be
able to accomodate your request. Or you could hack to add the code
yourself and donate it back.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Custom configuration for tomcat7:run goal

Posted by "Roberto C. Sánchez" <ro...@connexer.com>.
On Tue, Sep 02, 2014 at 04:11:47PM -0500, Wayne Fay wrote:
> > My question is: how do I get the web.xml that maven generates include the extra
> > directives that I need for the CORS filter to work when the project is launched from
> > Eclipse or the command line using the tomcat7:run goal?
> 
> Not sure if this is possible, but if it is, the documentation is a
> good place to start:
> https://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/run-mojo.html
> 

Wayne,

Thanks.  I've been reading tons of documentation and have read the
tomcat7-maven-plugin documentation in its entirety...twice.

For now I have settled on taking the generated web.xml and placing it
in src/main/tomcatconf/web.xml, then tweaking it with my custom
configuration directives.  I'm not terribly fond of this approach as it
seems to me that I am giving up the flexibility of letting the maven
build process generate the file.

What I hoped to accomplish was to put some specific snippets in pom.xml
or some other place and have maven pick up those snippets and drop them
in the right place in the generated web.xml.

In any event, this is only a concern for running using the embedded
tomcat with the tomcat7:run goal, so I'm not going to get too worked up
over it.

Regards,

-Roberto
-- 
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Custom configuration for tomcat7:run goal

Posted by Wayne Fay <wa...@gmail.com>.
> My question is: how do I get the web.xml that maven generates include the extra
> directives that I need for the CORS filter to work when the project is launched from
> Eclipse or the command line using the tomcat7:run goal?

Not sure if this is possible, but if it is, the documentation is a
good place to start:
https://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/run-mojo.html

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org