You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dane Laverty <da...@gmail.com> on 2009/05/20 18:40:58 UTC

Separating Development and Deployment

I've got my project set up to deploy with Maven's Tomcat plugin now. My next
step is getting the web.xml to use the correct Wicket configuration
(development/deployment) value. Is there a way to run two separate web.xml
files for the application, and then somehow have Maven pick up the correct
one when I run "mvn tomcat:deploy"? Or am I going about this the wrong way
entirely? I've done some reading and it sounds like people are using "web
resource filtering" to address the issue, however to me it seems that it
just moves the parameters from the web.xml to the pom.xml, and that I would
have to manually change them in the pom.xml when I want to change from
deployment to development.

Re: Separating Development and Deployment

Posted by Martijn Dashorst <ma...@gmail.com>.
Usually it is best to move such configuration out of your war file.
i.e. use a datasource for your database connection, etc.

You don't want to have to build 3 wars for different environments:
test, usertest and production.

Martijn

On Wed, May 20, 2009 at 9:01 PM, Dane Laverty <da...@gmail.com> wrote:
> Thanks for piping in, Martijn. I should have clarified, my deployment and
> development environments use different databases. I'm storing the database
> connection information inside of the web.xml also, so I need to be able to
> switch those as well as the Wicket configuration depending on the
> environment. I suppose I could store the connection information for both,
> and then select one based on the Wicket configuration, though that sounds a
> little hack-ish.
>
> On Wed, May 20, 2009 at 11:51 AM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
>> Set a system property in your server config or startup script that
>> tells wicket it's running in deployment mode.
>> -Dwicket.configuration=deployment is all there's to it.
>>
>> Martijn
>>
>> On Wed, May 20, 2009 at 6:40 PM, Dane Laverty <da...@gmail.com>
>> wrote:
>> > I've got my project set up to deploy with Maven's Tomcat plugin now. My
>> next
>> > step is getting the web.xml to use the correct Wicket configuration
>> > (development/deployment) value. Is there a way to run two separate
>> web.xml
>> > files for the application, and then somehow have Maven pick up the
>> correct
>> > one when I run "mvn tomcat:deploy"? Or am I going about this the wrong
>> way
>> > entirely? I've done some reading and it sounds like people are using "web
>> > resource filtering" to address the issue, however to me it seems that it
>> > just moves the parameters from the web.xml to the pom.xml, and that I
>> would
>> > have to manually change them in the pom.xml when I want to change from
>> > deployment to development.
>> >
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Separating Development and Deployment

Posted by Dane Laverty <da...@gmail.com>.
Thanks for piping in, Martijn. I should have clarified, my deployment and
development environments use different databases. I'm storing the database
connection information inside of the web.xml also, so I need to be able to
switch those as well as the Wicket configuration depending on the
environment. I suppose I could store the connection information for both,
and then select one based on the Wicket configuration, though that sounds a
little hack-ish.

On Wed, May 20, 2009 at 11:51 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Set a system property in your server config or startup script that
> tells wicket it's running in deployment mode.
> -Dwicket.configuration=deployment is all there's to it.
>
> Martijn
>
> On Wed, May 20, 2009 at 6:40 PM, Dane Laverty <da...@gmail.com>
> wrote:
> > I've got my project set up to deploy with Maven's Tomcat plugin now. My
> next
> > step is getting the web.xml to use the correct Wicket configuration
> > (development/deployment) value. Is there a way to run two separate
> web.xml
> > files for the application, and then somehow have Maven pick up the
> correct
> > one when I run "mvn tomcat:deploy"? Or am I going about this the wrong
> way
> > entirely? I've done some reading and it sounds like people are using "web
> > resource filtering" to address the issue, however to me it seems that it
> > just moves the parameters from the web.xml to the pom.xml, and that I
> would
> > have to manually change them in the pom.xml when I want to change from
> > deployment to development.
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Separating Development and Deployment

Posted by Martijn Dashorst <ma...@gmail.com>.
Set a system property in your server config or startup script that
tells wicket it's running in deployment mode.
-Dwicket.configuration=deployment is all there's to it.

Martijn

On Wed, May 20, 2009 at 6:40 PM, Dane Laverty <da...@gmail.com> wrote:
> I've got my project set up to deploy with Maven's Tomcat plugin now. My next
> step is getting the web.xml to use the correct Wicket configuration
> (development/deployment) value. Is there a way to run two separate web.xml
> files for the application, and then somehow have Maven pick up the correct
> one when I run "mvn tomcat:deploy"? Or am I going about this the wrong way
> entirely? I've done some reading and it sounds like people are using "web
> resource filtering" to address the issue, however to me it seems that it
> just moves the parameters from the web.xml to the pom.xml, and that I would
> have to manually change them in the pom.xml when I want to change from
> deployment to development.
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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


Re: Separating Development and Deployment

Posted by Dane Laverty <da...@gmail.com>.
Awesome, that's exactly what I was looking for. Thanks!

On Wed, May 20, 2009 at 9:59 AM, Clint Popetz <cl...@42lines.net> wrote:

> I recommend using ${} variables in web.xml and resource filtering, as
> you mentioned, but  the way to avoid changing them all the time in
> pom.xml is to have different maven profiles that set them differently
> in your pom.  It is true that you'll have to do things like
> -PtomcatDeployment when running maven to activate them, but then all
> your random variables are controlled by a uniform set of profiles, and
> you aren't trying to remember which options to set for which target
> deployment.  You can also set up the profiles to be active based on
> certain environments, or automate setting them in build scripts or in
> settings.xml.
>
> Maven profiles are da bomb, IMHO.  Especially when building for lots
> of target environments
> (qa/mirroring/local-dev/load-testing/continuous-integration) and on
> different platforms.
>
> -Clint
>
> On Wed, May 20, 2009 at 11:40 AM, Dane Laverty <da...@gmail.com>
> wrote:
> > I've got my project set up to deploy with Maven's Tomcat plugin now. My
> next
> > step is getting the web.xml to use the correct Wicket configuration
> > (development/deployment) value. Is there a way to run two separate
> web.xml
> > files for the application, and then somehow have Maven pick up the
> correct
> > one when I run "mvn tomcat:deploy"? Or am I going about this the wrong
> way
> > entirely? I've done some reading and it sounds like people are using "web
> > resource filtering" to address the issue, however to me it seems that it
> > just moves the parameters from the web.xml to the pom.xml, and that I
> would
> > have to manually change them in the pom.xml when I want to change from
> > deployment to development.
> >
>
>
>
> --
> Clint Popetz
> http://42lines.net
> Scalable Web Application Development
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Separating Development and Deployment

Posted by James Carman <jc...@carmanconsulting.com>.
On Wed, May 20, 2009 at 2:35 PM, Dane Laverty <da...@gmail.com> wrote:
> Clint - I've run into one (hopefully minor) hitch with the process. The
> filtering works, but only after I've used Maven to deploy the project. When
> I'm developing, however, I just run the project on the Jetty server that
> comes with the Quickstart. Of course, that means that the ${} variables are
> treated as literal values. Is there a way to filter the project locally
> without having to run a Maven build every time I make a change?

Yeah, we ran into that issue before and that's why we decided to go my
route.  It works much better.

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


Re: Separating Development and Deployment

Posted by Clint Popetz <cl...@42lines.net>.
The way I solve that locally (and it may not be a best practice, but
it works, eh?) is to use m2eclipse, so that mvn filtering happens
incrementally as I change things in eclipse.   I also set up maven to
copy my src/main/webapp directory into  target/test-classes, i.e.:

    <testResources>
      <testResource>
        <filtering>false</filtering>
        <directory>src/main/webapp</directory>
        </testResource>
      <testResource>
        <filtering>true</filtering>
        <directory>src/main/webapp/WEB-INF</directory>
        <targetPath>WEB-INF</targetPath>
      </testResource>
      <testResource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>

This results in a project in eclipse which has src/main/webapp as a
source directory wtih output folder target/test-classes.  Then, in
Start.java I do:

		webapp.setWar("target/test-classes");

I also tell maven (in eclipse) which profile I want to use, in Project
-> Properties -> Maven -> Active Maven Profiles so I get the right
filtering locally.  This has the advantage of being able to test other
maven profiles by changing the above setting, and still running from
within eclipse, for example to see if things run correctly in
deployment mode.

-Clint

On Wed, May 20, 2009 at 1:35 PM, Dane Laverty <da...@gmail.com> wrote:
> Clint - I've run into one (hopefully minor) hitch with the process. The
> filtering works, but only after I've used Maven to deploy the project. When
> I'm developing, however, I just run the project on the Jetty server that
> comes with the Quickstart. Of course, that means that the ${} variables are
> treated as literal values. Is there a way to filter the project locally
> without having to run a Maven build every time I make a change?
>
> James - Spring and Hibernate are next on my things-to-learn list, after I
> get Maven (and perhaps Continuum) figured out.
>
> Thanks to both of you for the input!
>
>
> On Wed, May 20, 2009 at 10:48 AM, James Carman <jcarman@carmanconsulting.com
>> wrote:
>
>> Check out the way I did it in my wicket-advanced example application:
>>
>> http://svn.carmanconsulting.com/public/wicket-advanced/trunk
>>
>> I did a combination of maven profiles and Spring's
>> PropertyPlaceholderConfigurer.  If you're not using Spring, it won't
>> help, but if you are, it might be interesting to you.
>>
>> On Wed, May 20, 2009 at 12:59 PM, Clint Popetz <cl...@42lines.net> wrote:
>> > I recommend using ${} variables in web.xml and resource filtering, as
>> > you mentioned, but  the way to avoid changing them all the time in
>> > pom.xml is to have different maven profiles that set them differently
>> > in your pom.  It is true that you'll have to do things like
>> > -PtomcatDeployment when running maven to activate them, but then all
>> > your random variables are controlled by a uniform set of profiles, and
>> > you aren't trying to remember which options to set for which target
>> > deployment.  You can also set up the profiles to be active based on
>> > certain environments, or automate setting them in build scripts or in
>> > settings.xml.
>> >
>> > Maven profiles are da bomb, IMHO.  Especially when building for lots
>> > of target environments
>> > (qa/mirroring/local-dev/load-testing/continuous-integration) and on
>> > different platforms.
>> >
>> > -Clint
>> >
>> > On Wed, May 20, 2009 at 11:40 AM, Dane Laverty <da...@gmail.com>
>> wrote:
>> >> I've got my project set up to deploy with Maven's Tomcat plugin now. My
>> next
>> >> step is getting the web.xml to use the correct Wicket configuration
>> >> (development/deployment) value. Is there a way to run two separate
>> web.xml
>> >> files for the application, and then somehow have Maven pick up the
>> correct
>> >> one when I run "mvn tomcat:deploy"? Or am I going about this the wrong
>> way
>> >> entirely? I've done some reading and it sounds like people are using
>> "web
>> >> resource filtering" to address the issue, however to me it seems that it
>> >> just moves the parameters from the web.xml to the pom.xml, and that I
>> would
>> >> have to manually change them in the pom.xml when I want to change from
>> >> deployment to development.
>> >>
>> >
>> >
>> >
>> > --
>> > Clint Popetz
>> > http://42lines.net
>> > Scalable Web Application Development
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>



-- 
Clint Popetz
http://42lines.net
Scalable Web Application Development

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


Re: Separating Development and Deployment

Posted by Dane Laverty <da...@gmail.com>.
Clint - I've run into one (hopefully minor) hitch with the process. The
filtering works, but only after I've used Maven to deploy the project. When
I'm developing, however, I just run the project on the Jetty server that
comes with the Quickstart. Of course, that means that the ${} variables are
treated as literal values. Is there a way to filter the project locally
without having to run a Maven build every time I make a change?

James - Spring and Hibernate are next on my things-to-learn list, after I
get Maven (and perhaps Continuum) figured out.

Thanks to both of you for the input!


On Wed, May 20, 2009 at 10:48 AM, James Carman <jcarman@carmanconsulting.com
> wrote:

> Check out the way I did it in my wicket-advanced example application:
>
> http://svn.carmanconsulting.com/public/wicket-advanced/trunk
>
> I did a combination of maven profiles and Spring's
> PropertyPlaceholderConfigurer.  If you're not using Spring, it won't
> help, but if you are, it might be interesting to you.
>
> On Wed, May 20, 2009 at 12:59 PM, Clint Popetz <cl...@42lines.net> wrote:
> > I recommend using ${} variables in web.xml and resource filtering, as
> > you mentioned, but  the way to avoid changing them all the time in
> > pom.xml is to have different maven profiles that set them differently
> > in your pom.  It is true that you'll have to do things like
> > -PtomcatDeployment when running maven to activate them, but then all
> > your random variables are controlled by a uniform set of profiles, and
> > you aren't trying to remember which options to set for which target
> > deployment.  You can also set up the profiles to be active based on
> > certain environments, or automate setting them in build scripts or in
> > settings.xml.
> >
> > Maven profiles are da bomb, IMHO.  Especially when building for lots
> > of target environments
> > (qa/mirroring/local-dev/load-testing/continuous-integration) and on
> > different platforms.
> >
> > -Clint
> >
> > On Wed, May 20, 2009 at 11:40 AM, Dane Laverty <da...@gmail.com>
> wrote:
> >> I've got my project set up to deploy with Maven's Tomcat plugin now. My
> next
> >> step is getting the web.xml to use the correct Wicket configuration
> >> (development/deployment) value. Is there a way to run two separate
> web.xml
> >> files for the application, and then somehow have Maven pick up the
> correct
> >> one when I run "mvn tomcat:deploy"? Or am I going about this the wrong
> way
> >> entirely? I've done some reading and it sounds like people are using
> "web
> >> resource filtering" to address the issue, however to me it seems that it
> >> just moves the parameters from the web.xml to the pom.xml, and that I
> would
> >> have to manually change them in the pom.xml when I want to change from
> >> deployment to development.
> >>
> >
> >
> >
> > --
> > Clint Popetz
> > http://42lines.net
> > Scalable Web Application Development
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Separating Development and Deployment

Posted by James Carman <jc...@carmanconsulting.com>.
Check out the way I did it in my wicket-advanced example application:

http://svn.carmanconsulting.com/public/wicket-advanced/trunk

I did a combination of maven profiles and Spring's
PropertyPlaceholderConfigurer.  If you're not using Spring, it won't
help, but if you are, it might be interesting to you.

On Wed, May 20, 2009 at 12:59 PM, Clint Popetz <cl...@42lines.net> wrote:
> I recommend using ${} variables in web.xml and resource filtering, as
> you mentioned, but  the way to avoid changing them all the time in
> pom.xml is to have different maven profiles that set them differently
> in your pom.  It is true that you'll have to do things like
> -PtomcatDeployment when running maven to activate them, but then all
> your random variables are controlled by a uniform set of profiles, and
> you aren't trying to remember which options to set for which target
> deployment.  You can also set up the profiles to be active based on
> certain environments, or automate setting them in build scripts or in
> settings.xml.
>
> Maven profiles are da bomb, IMHO.  Especially when building for lots
> of target environments
> (qa/mirroring/local-dev/load-testing/continuous-integration) and on
> different platforms.
>
> -Clint
>
> On Wed, May 20, 2009 at 11:40 AM, Dane Laverty <da...@gmail.com> wrote:
>> I've got my project set up to deploy with Maven's Tomcat plugin now. My next
>> step is getting the web.xml to use the correct Wicket configuration
>> (development/deployment) value. Is there a way to run two separate web.xml
>> files for the application, and then somehow have Maven pick up the correct
>> one when I run "mvn tomcat:deploy"? Or am I going about this the wrong way
>> entirely? I've done some reading and it sounds like people are using "web
>> resource filtering" to address the issue, however to me it seems that it
>> just moves the parameters from the web.xml to the pom.xml, and that I would
>> have to manually change them in the pom.xml when I want to change from
>> deployment to development.
>>
>
>
>
> --
> Clint Popetz
> http://42lines.net
> Scalable Web Application Development
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Separating Development and Deployment

Posted by Clint Popetz <cl...@42lines.net>.
I recommend using ${} variables in web.xml and resource filtering, as
you mentioned, but  the way to avoid changing them all the time in
pom.xml is to have different maven profiles that set them differently
in your pom.  It is true that you'll have to do things like
-PtomcatDeployment when running maven to activate them, but then all
your random variables are controlled by a uniform set of profiles, and
you aren't trying to remember which options to set for which target
deployment.  You can also set up the profiles to be active based on
certain environments, or automate setting them in build scripts or in
settings.xml.

Maven profiles are da bomb, IMHO.  Especially when building for lots
of target environments
(qa/mirroring/local-dev/load-testing/continuous-integration) and on
different platforms.

-Clint

On Wed, May 20, 2009 at 11:40 AM, Dane Laverty <da...@gmail.com> wrote:
> I've got my project set up to deploy with Maven's Tomcat plugin now. My next
> step is getting the web.xml to use the correct Wicket configuration
> (development/deployment) value. Is there a way to run two separate web.xml
> files for the application, and then somehow have Maven pick up the correct
> one when I run "mvn tomcat:deploy"? Or am I going about this the wrong way
> entirely? I've done some reading and it sounds like people are using "web
> resource filtering" to address the issue, however to me it seems that it
> just moves the parameters from the web.xml to the pom.xml, and that I would
> have to manually change them in the pom.xml when I want to change from
> deployment to development.
>



-- 
Clint Popetz
http://42lines.net
Scalable Web Application Development

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