You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sergei Dubov <sd...@gmail.com> on 2006/03/14 04:18:50 UTC

Running Java Progs

Hi guys,

I am a complete Maven newbie (but a fairly advanced Ant user). I 
attended Jason's presentation at Toronto JUG and was very impressed with 
the value proposition of Maven.

I am still getting my head around the Maven philosophy part. But I do 
keep pushing ahead. :-) A couple of questions that I need answering.

1. I can't seem to find a plugin for running Java progs, akin to Ant's 
java task. And if it is missing, is it appropriate (philosophically 
speaking) to just script an Ant task to the pom.xml?

2. I really need to understand how to handle project specific settings 
for each user. Stuff like DB configs, app server specific configuration 
files. Basically 3-4 *.properties files with config info in them.

I appreciate any response.

Thanks!

Serge

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


Re: Running Java Progs

Posted by Simon Kitching <sk...@apache.org>.
On Mon, 2006-03-13 at 22:47 -0500, Alexandre Poitras wrote:
> On 3/13/06, Sergei Dubov <sd...@gmail.com> wrote:
> > Hi guys,
> >
> > I am a complete Maven newbie (but a fairly advanced Ant user). I
> > attended Jason's presentation at Toronto JUG and was very impressed with
> > the value proposition of Maven.
> >
> > I am still getting my head around the Maven philosophy part. But I do
> > keep pushing ahead. :-) A couple of questions that I need answering.
> >
> > 1. I can't seem to find a plugin for running Java progs, akin to Ant's
> > java task. And if it is missing, is it appropriate (philosophically
> > speaking) to just script an Ant task to the pom.xml?
> 
> This is what you want :
> http://mojo.codehaus.org/exec-maven-plugin/introduction.html

or possibly the standard antrun plugin:
http://maven.apache.org/plugins/maven-antrun-plugin/

Cheers,

Simon



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


Re: User Profiles

Posted by Wayne Fay <wa...@gmail.com>.
Yes I understand that. That's why I was suggesting the Maven2 approach
with resources and filters. ;-)

This is all very possible with standard Maven2 usage and xml
configuration files etc. I have presently defined "dev_workstation" as
active, "dev", "qe", and "prod" in my profiles. Hoping to get the full
build, configure, deploy in a single Maven command at some point in
the near future (it hasn't really been a goal for me, so I haven't
bothered to get it working 100% in Maven yet).

Assuming you get your full process in a single command, perhaps post
your pom etc back to the list for other people's usage?

Wayne


On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> The point is of course that I am talking about properties files specific
> to the application and not the build process. Just wanted to make it clear.
>
> Serge
>
> Wayne Fay wrote:
> > Simon is right... I simply went "whole hog" with Maven2 as much as
> > possible, and except for the Oc4j deployment via Ant, I have
> > eliminated all "old" ant *.properties files in favor of profiles.
> >
> > So instead of various properties files in various places in my project
> > filesystem, I've got it all contained in a single profile.xml file,
> > and I'm much happier with the centralized management of all properties
> > used in my project.
> >
> > Wayne
> >
> >
> > On 3/14/06, Simon Kitching <sk...@apache.org> wrote:
> >
> >>While Wayne's suggestion is probably better "maven style", I expect you
> >>could also use the maven-antrun-plugin to execute an external ant task
> >>at the process-resources phase.
> >>http://maven.apache.org/plugins/maven-antrun-plugin/
> >>http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
> >>http://maven.apache.org/guides/mini/guide-configuring-plugins.html
> >>
> >>On Tue, 2006-03-14 at 11:10 -0600, Wayne Fay wrote:
> >>
> >>>Well first off, those properties files need to be placed in
> >>>src/main/resources. Then you need to learn about filtering. ;-)
> >>>
> >>>So what you do is something along these lines...
> >>>/src/main/resources/c3p0.properties
> >>>blah=abc
> >>>yadda=xyz
> >>>server=${c3p0.server}
> >>>
> >>>Then in pom.xml:
> >>>  <build>
> >>>    <resources>
> >>>      <resource>
> >>>        <directory>src/main/resources</directory>
> >>>        <filtering>true</filtering>
> >>>      </resource>
> >>>    </resources>
> >>>  </build>
> >>>
> >>>And then the profile & properties data in pom.xml or profile.xml.
> >>>
> >>>Then finally:
> >>>mvn package -P name1
> >>>
> >>>And the proper variable values will be substituted into your
> >>>properties files during the filter step.
> >>>
> >>>HTH.
> >>>Wayne
> >>>
> >>>On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> >>>
> >>>>But those properties files are referenced by Spring configurations in
> >>>>turn, c3p0.properties is the default for c3p0 connection pool
> >>>>configuration. This all happens after deploying in Tomcat. How would
> >>>>Spring know about Maven configurations when the war file is deployed on
> >>>>a remote server? :-)
> >>>>
> >>>>I am open to other approaches but they have to work for one-stop builds.
> >>>>I clearly want to be able to run a single command and have the app
> >>>>deployed to a remote server with all the necessary configs.
> >>>>
> >>>>Serge
> >>>>
> >>>>Wayne Fay wrote:
> >>>>
> >>>>>With a new build environment comes changes to your existing build.
> >>>>>When you moved to Ant, you made these properties files. Now it might
> >>>>>be time to change again if you move to Maven. So just realize upfront
> >>>>>that you will probably have to change.
> >>>>>
> >>>>>The easiest way to achieve your requirements is through the use of
> >>>>>profiles either in pom.xml, settings.xml, or profiles.xml file. Then
> >>>>>you call "mvn -P name1 package" and it uses the variable values you
> >>>>>have defined in the "name1" profile.
> >>>>>See this page for more info:
> >>>>>http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> >>>>>
> >>>>>If you want to keep your existing properties files and build process,
> >>>>>stay in Ant. You could probably write some complicated plugin to
> >>>>>duplicate what you already have in ANT, but I wouldn't do it.
> >>>>>
> >>>>>Wayne
> >>>>>
> >>>>>
> >>>>>On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> >>>>>
> >>>>>
> >>>>>>I am still trying to get my head around the concept of user profiles
> >>>>>>(using Maven2). Here is what I do in Ant:
> >>>>>>
> >>>>>>1. Let's say we have a project called "leonardo".
> >>>>>>
> >>>>>>2. To work with my Ant process the user is required to have a directory
> >>>>>>called $HOME/.leonardorc and an environment variable called
> >>>>>>$LEONARDO_EXT that contains his current configurational profile.
> >>>>>>
> >>>>>>3. $HOME/.leonardorc contains customer properties files. Let's say:
> >>>>>>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
> >>>>>>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
> >>>>>>specific to that user's current profile (set by LEONARD_EXT).
> >>>>>>
> >>>>>>4. The moment a user tries to do something (build, deploy, whatever).
> >>>>>>Some of those files will be copied to the "right" place in the project
> >>>>>>repository, and some will be directly referenced in the Ant build
> >>>>>>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
> >>>>>>copy.
> >>>>>>
> >>>>>>I'd really appreciate if somebody could explain to me how to achieve the
> >>>>>>same flexibility with Maven. Note: the above-mentioned property files
> >>>>>>have to be the entities that specify the user configuration.
> >>>>>>
> >>>>>>Thanks a lot beforehand!
> >>>>>>
> >>>>>>Serge
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>>For additional commands, e-mail: users-help@maven.apache.org
> >>>>
> >>>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: User Profiles

Posted by Sergei Dubov <sd...@gmail.com>.
The point is of course that I am talking about properties files specific 
to the application and not the build process. Just wanted to make it clear.

Serge

Wayne Fay wrote:
> Simon is right... I simply went "whole hog" with Maven2 as much as
> possible, and except for the Oc4j deployment via Ant, I have
> eliminated all "old" ant *.properties files in favor of profiles.
> 
> So instead of various properties files in various places in my project
> filesystem, I've got it all contained in a single profile.xml file,
> and I'm much happier with the centralized management of all properties
> used in my project.
> 
> Wayne
> 
> 
> On 3/14/06, Simon Kitching <sk...@apache.org> wrote:
> 
>>While Wayne's suggestion is probably better "maven style", I expect you
>>could also use the maven-antrun-plugin to execute an external ant task
>>at the process-resources phase.
>>http://maven.apache.org/plugins/maven-antrun-plugin/
>>http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
>>http://maven.apache.org/guides/mini/guide-configuring-plugins.html
>>
>>On Tue, 2006-03-14 at 11:10 -0600, Wayne Fay wrote:
>>
>>>Well first off, those properties files need to be placed in
>>>src/main/resources. Then you need to learn about filtering. ;-)
>>>
>>>So what you do is something along these lines...
>>>/src/main/resources/c3p0.properties
>>>blah=abc
>>>yadda=xyz
>>>server=${c3p0.server}
>>>
>>>Then in pom.xml:
>>>  <build>
>>>    <resources>
>>>      <resource>
>>>        <directory>src/main/resources</directory>
>>>        <filtering>true</filtering>
>>>      </resource>
>>>    </resources>
>>>  </build>
>>>
>>>And then the profile & properties data in pom.xml or profile.xml.
>>>
>>>Then finally:
>>>mvn package -P name1
>>>
>>>And the proper variable values will be substituted into your
>>>properties files during the filter step.
>>>
>>>HTH.
>>>Wayne
>>>
>>>On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
>>>
>>>>But those properties files are referenced by Spring configurations in
>>>>turn, c3p0.properties is the default for c3p0 connection pool
>>>>configuration. This all happens after deploying in Tomcat. How would
>>>>Spring know about Maven configurations when the war file is deployed on
>>>>a remote server? :-)
>>>>
>>>>I am open to other approaches but they have to work for one-stop builds.
>>>>I clearly want to be able to run a single command and have the app
>>>>deployed to a remote server with all the necessary configs.
>>>>
>>>>Serge
>>>>
>>>>Wayne Fay wrote:
>>>>
>>>>>With a new build environment comes changes to your existing build.
>>>>>When you moved to Ant, you made these properties files. Now it might
>>>>>be time to change again if you move to Maven. So just realize upfront
>>>>>that you will probably have to change.
>>>>>
>>>>>The easiest way to achieve your requirements is through the use of
>>>>>profiles either in pom.xml, settings.xml, or profiles.xml file. Then
>>>>>you call "mvn -P name1 package" and it uses the variable values you
>>>>>have defined in the "name1" profile.
>>>>>See this page for more info:
>>>>>http://maven.apache.org/guides/introduction/introduction-to-profiles.html
>>>>>
>>>>>If you want to keep your existing properties files and build process,
>>>>>stay in Ant. You could probably write some complicated plugin to
>>>>>duplicate what you already have in ANT, but I wouldn't do it.
>>>>>
>>>>>Wayne
>>>>>
>>>>>
>>>>>On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
>>>>>
>>>>>
>>>>>>I am still trying to get my head around the concept of user profiles
>>>>>>(using Maven2). Here is what I do in Ant:
>>>>>>
>>>>>>1. Let's say we have a project called "leonardo".
>>>>>>
>>>>>>2. To work with my Ant process the user is required to have a directory
>>>>>>called $HOME/.leonardorc and an environment variable called
>>>>>>$LEONARDO_EXT that contains his current configurational profile.
>>>>>>
>>>>>>3. $HOME/.leonardorc contains customer properties files. Let's say:
>>>>>>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
>>>>>>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
>>>>>>specific to that user's current profile (set by LEONARD_EXT).
>>>>>>
>>>>>>4. The moment a user tries to do something (build, deploy, whatever).
>>>>>>Some of those files will be copied to the "right" place in the project
>>>>>>repository, and some will be directly referenced in the Ant build
>>>>>>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
>>>>>>copy.
>>>>>>
>>>>>>I'd really appreciate if somebody could explain to me how to achieve the
>>>>>>same flexibility with Maven. Note: the above-mentioned property files
>>>>>>have to be the entities that specify the user configuration.
>>>>>>
>>>>>>Thanks a lot beforehand!
>>>>>>
>>>>>>Serge
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>

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


Re: User Profiles

Posted by Wayne Fay <wa...@gmail.com>.
Simon is right... I simply went "whole hog" with Maven2 as much as
possible, and except for the Oc4j deployment via Ant, I have
eliminated all "old" ant *.properties files in favor of profiles.

So instead of various properties files in various places in my project
filesystem, I've got it all contained in a single profile.xml file,
and I'm much happier with the centralized management of all properties
used in my project.

Wayne


On 3/14/06, Simon Kitching <sk...@apache.org> wrote:
> While Wayne's suggestion is probably better "maven style", I expect you
> could also use the maven-antrun-plugin to execute an external ant task
> at the process-resources phase.
> http://maven.apache.org/plugins/maven-antrun-plugin/
> http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
> http://maven.apache.org/guides/mini/guide-configuring-plugins.html
>
> On Tue, 2006-03-14 at 11:10 -0600, Wayne Fay wrote:
> > Well first off, those properties files need to be placed in
> > src/main/resources. Then you need to learn about filtering. ;-)
> >
> > So what you do is something along these lines...
> > /src/main/resources/c3p0.properties
> > blah=abc
> > yadda=xyz
> > server=${c3p0.server}
> >
> > Then in pom.xml:
> >   <build>
> >     <resources>
> >       <resource>
> >         <directory>src/main/resources</directory>
> >         <filtering>true</filtering>
> >       </resource>
> >     </resources>
> >   </build>
> >
> > And then the profile & properties data in pom.xml or profile.xml.
> >
> > Then finally:
> > mvn package -P name1
> >
> > And the proper variable values will be substituted into your
> > properties files during the filter step.
> >
> > HTH.
> > Wayne
> >
> > On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> > > But those properties files are referenced by Spring configurations in
> > > turn, c3p0.properties is the default for c3p0 connection pool
> > > configuration. This all happens after deploying in Tomcat. How would
> > > Spring know about Maven configurations when the war file is deployed on
> > > a remote server? :-)
> > >
> > > I am open to other approaches but they have to work for one-stop builds.
> > > I clearly want to be able to run a single command and have the app
> > > deployed to a remote server with all the necessary configs.
> > >
> > > Serge
> > >
> > > Wayne Fay wrote:
> > > > With a new build environment comes changes to your existing build.
> > > > When you moved to Ant, you made these properties files. Now it might
> > > > be time to change again if you move to Maven. So just realize upfront
> > > > that you will probably have to change.
> > > >
> > > > The easiest way to achieve your requirements is through the use of
> > > > profiles either in pom.xml, settings.xml, or profiles.xml file. Then
> > > > you call "mvn -P name1 package" and it uses the variable values you
> > > > have defined in the "name1" profile.
> > > > See this page for more info:
> > > > http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> > > >
> > > > If you want to keep your existing properties files and build process,
> > > > stay in Ant. You could probably write some complicated plugin to
> > > > duplicate what you already have in ANT, but I wouldn't do it.
> > > >
> > > > Wayne
> > > >
> > > >
> > > > On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> > > >
> > > >>I am still trying to get my head around the concept of user profiles
> > > >>(using Maven2). Here is what I do in Ant:
> > > >>
> > > >>1. Let's say we have a project called "leonardo".
> > > >>
> > > >>2. To work with my Ant process the user is required to have a directory
> > > >>called $HOME/.leonardorc and an environment variable called
> > > >>$LEONARDO_EXT that contains his current configurational profile.
> > > >>
> > > >>3. $HOME/.leonardorc contains customer properties files. Let's say:
> > > >>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
> > > >>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
> > > >>specific to that user's current profile (set by LEONARD_EXT).
> > > >>
> > > >>4. The moment a user tries to do something (build, deploy, whatever).
> > > >>Some of those files will be copied to the "right" place in the project
> > > >>repository, and some will be directly referenced in the Ant build
> > > >>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
> > > >>copy.
> > > >>
> > > >>I'd really appreciate if somebody could explain to me how to achieve the
> > > >>same flexibility with Maven. Note: the above-mentioned property files
> > > >>have to be the entities that specify the user configuration.
> > > >>
> > > >>Thanks a lot beforehand!
> > > >>
> > > >>Serge
> > > >>
> > > >>
> > > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: User Profiles

Posted by Simon Kitching <sk...@apache.org>.
While Wayne's suggestion is probably better "maven style", I expect you
could also use the maven-antrun-plugin to execute an external ant task
at the process-resources phase.
http://maven.apache.org/plugins/maven-antrun-plugin/
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
http://maven.apache.org/guides/mini/guide-configuring-plugins.html

On Tue, 2006-03-14 at 11:10 -0600, Wayne Fay wrote:
> Well first off, those properties files need to be placed in
> src/main/resources. Then you need to learn about filtering. ;-)
> 
> So what you do is something along these lines...
> /src/main/resources/c3p0.properties
> blah=abc
> yadda=xyz
> server=${c3p0.server}
> 
> Then in pom.xml:
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>   </build>
> 
> And then the profile & properties data in pom.xml or profile.xml.
> 
> Then finally:
> mvn package -P name1
> 
> And the proper variable values will be substituted into your
> properties files during the filter step.
> 
> HTH.
> Wayne
> 
> On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> > But those properties files are referenced by Spring configurations in
> > turn, c3p0.properties is the default for c3p0 connection pool
> > configuration. This all happens after deploying in Tomcat. How would
> > Spring know about Maven configurations when the war file is deployed on
> > a remote server? :-)
> >
> > I am open to other approaches but they have to work for one-stop builds.
> > I clearly want to be able to run a single command and have the app
> > deployed to a remote server with all the necessary configs.
> >
> > Serge
> >
> > Wayne Fay wrote:
> > > With a new build environment comes changes to your existing build.
> > > When you moved to Ant, you made these properties files. Now it might
> > > be time to change again if you move to Maven. So just realize upfront
> > > that you will probably have to change.
> > >
> > > The easiest way to achieve your requirements is through the use of
> > > profiles either in pom.xml, settings.xml, or profiles.xml file. Then
> > > you call "mvn -P name1 package" and it uses the variable values you
> > > have defined in the "name1" profile.
> > > See this page for more info:
> > > http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> > >
> > > If you want to keep your existing properties files and build process,
> > > stay in Ant. You could probably write some complicated plugin to
> > > duplicate what you already have in ANT, but I wouldn't do it.
> > >
> > > Wayne
> > >
> > >
> > > On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> > >
> > >>I am still trying to get my head around the concept of user profiles
> > >>(using Maven2). Here is what I do in Ant:
> > >>
> > >>1. Let's say we have a project called "leonardo".
> > >>
> > >>2. To work with my Ant process the user is required to have a directory
> > >>called $HOME/.leonardorc and an environment variable called
> > >>$LEONARDO_EXT that contains his current configurational profile.
> > >>
> > >>3. $HOME/.leonardorc contains customer properties files. Let's say:
> > >>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
> > >>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
> > >>specific to that user's current profile (set by LEONARD_EXT).
> > >>
> > >>4. The moment a user tries to do something (build, deploy, whatever).
> > >>Some of those files will be copied to the "right" place in the project
> > >>repository, and some will be directly referenced in the Ant build
> > >>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
> > >>copy.
> > >>
> > >>I'd really appreciate if somebody could explain to me how to achieve the
> > >>same flexibility with Maven. Note: the above-mentioned property files
> > >>have to be the entities that specify the user configuration.
> > >>
> > >>Thanks a lot beforehand!
> > >>
> > >>Serge
> > >>
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >


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


Re: User Profiles

Posted by Wayne Fay <wa...@gmail.com>.
Well first off, those properties files need to be placed in
src/main/resources. Then you need to learn about filtering. ;-)

So what you do is something along these lines...
/src/main/resources/c3p0.properties
blah=abc
yadda=xyz
server=${c3p0.server}

Then in pom.xml:
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

And then the profile & properties data in pom.xml or profile.xml.

Then finally:
mvn package -P name1

And the proper variable values will be substituted into your
properties files during the filter step.

HTH.
Wayne

On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> But those properties files are referenced by Spring configurations in
> turn, c3p0.properties is the default for c3p0 connection pool
> configuration. This all happens after deploying in Tomcat. How would
> Spring know about Maven configurations when the war file is deployed on
> a remote server? :-)
>
> I am open to other approaches but they have to work for one-stop builds.
> I clearly want to be able to run a single command and have the app
> deployed to a remote server with all the necessary configs.
>
> Serge
>
> Wayne Fay wrote:
> > With a new build environment comes changes to your existing build.
> > When you moved to Ant, you made these properties files. Now it might
> > be time to change again if you move to Maven. So just realize upfront
> > that you will probably have to change.
> >
> > The easiest way to achieve your requirements is through the use of
> > profiles either in pom.xml, settings.xml, or profiles.xml file. Then
> > you call "mvn -P name1 package" and it uses the variable values you
> > have defined in the "name1" profile.
> > See this page for more info:
> > http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> >
> > If you want to keep your existing properties files and build process,
> > stay in Ant. You could probably write some complicated plugin to
> > duplicate what you already have in ANT, but I wouldn't do it.
> >
> > Wayne
> >
> >
> > On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> >
> >>I am still trying to get my head around the concept of user profiles
> >>(using Maven2). Here is what I do in Ant:
> >>
> >>1. Let's say we have a project called "leonardo".
> >>
> >>2. To work with my Ant process the user is required to have a directory
> >>called $HOME/.leonardorc and an environment variable called
> >>$LEONARDO_EXT that contains his current configurational profile.
> >>
> >>3. $HOME/.leonardorc contains customer properties files. Let's say:
> >>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
> >>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
> >>specific to that user's current profile (set by LEONARD_EXT).
> >>
> >>4. The moment a user tries to do something (build, deploy, whatever).
> >>Some of those files will be copied to the "right" place in the project
> >>repository, and some will be directly referenced in the Ant build
> >>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
> >>copy.
> >>
> >>I'd really appreciate if somebody could explain to me how to achieve the
> >>same flexibility with Maven. Note: the above-mentioned property files
> >>have to be the entities that specify the user configuration.
> >>
> >>Thanks a lot beforehand!
> >>
> >>Serge
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: User Profiles

Posted by Sergei Dubov <sd...@gmail.com>.
But those properties files are referenced by Spring configurations in 
turn, c3p0.properties is the default for c3p0 connection pool 
configuration. This all happens after deploying in Tomcat. How would 
Spring know about Maven configurations when the war file is deployed on 
a remote server? :-)

I am open to other approaches but they have to work for one-stop builds. 
I clearly want to be able to run a single command and have the app 
deployed to a remote server with all the necessary configs.

Serge

Wayne Fay wrote:
> With a new build environment comes changes to your existing build.
> When you moved to Ant, you made these properties files. Now it might
> be time to change again if you move to Maven. So just realize upfront
> that you will probably have to change.
> 
> The easiest way to achieve your requirements is through the use of
> profiles either in pom.xml, settings.xml, or profiles.xml file. Then
> you call "mvn -P name1 package" and it uses the variable values you
> have defined in the "name1" profile.
> See this page for more info:
> http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> 
> If you want to keep your existing properties files and build process,
> stay in Ant. You could probably write some complicated plugin to
> duplicate what you already have in ANT, but I wouldn't do it.
> 
> Wayne
> 
> 
> On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> 
>>I am still trying to get my head around the concept of user profiles
>>(using Maven2). Here is what I do in Ant:
>>
>>1. Let's say we have a project called "leonardo".
>>
>>2. To work with my Ant process the user is required to have a directory
>>called $HOME/.leonardorc and an environment variable called
>>$LEONARDO_EXT that contains his current configurational profile.
>>
>>3. $HOME/.leonardorc contains customer properties files. Let's say:
>>db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
>>tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
>>specific to that user's current profile (set by LEONARD_EXT).
>>
>>4. The moment a user tries to do something (build, deploy, whatever).
>>Some of those files will be copied to the "right" place in the project
>>repository, and some will be directly referenced in the Ant build
>>script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
>>copy.
>>
>>I'd really appreciate if somebody could explain to me how to achieve the
>>same flexibility with Maven. Note: the above-mentioned property files
>>have to be the entities that specify the user configuration.
>>
>>Thanks a lot beforehand!
>>
>>Serge
>>
>>
>>

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


Re: User Profiles

Posted by Wayne Fay <wa...@gmail.com>.
With a new build environment comes changes to your existing build.
When you moved to Ant, you made these properties files. Now it might
be time to change again if you move to Maven. So just realize upfront
that you will probably have to change.

The easiest way to achieve your requirements is through the use of
profiles either in pom.xml, settings.xml, or profiles.xml file. Then
you call "mvn -P name1 package" and it uses the variable values you
have defined in the "name1" profile.
See this page for more info:
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

If you want to keep your existing properties files and build process,
stay in Ant. You could probably write some complicated plugin to
duplicate what you already have in ANT, but I wouldn't do it.

Wayne


On 3/14/06, Sergei Dubov <sd...@gmail.com> wrote:
> I am still trying to get my head around the concept of user profiles
> (using Maven2). Here is what I do in Ant:
>
> 1. Let's say we have a project called "leonardo".
>
> 2. To work with my Ant process the user is required to have a directory
> called $HOME/.leonardorc and an environment variable called
> $LEONARDO_EXT that contains his current configurational profile.
>
> 3. $HOME/.leonardorc contains customer properties files. Let's say:
> db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT},
> tomcat.properties.${LEONARDO_EXT}. They all contain configurational info
> specific to that user's current profile (set by LEONARD_EXT).
>
> 4. The moment a user tries to do something (build, deploy, whatever).
> Some of those files will be copied to the "right" place in the project
> repository, and some will be directly referenced in the Ant build
> script. Of course, the extension of ${LEONARDO_EXT} will be removed upon
> copy.
>
> I'd really appreciate if somebody could explain to me how to achieve the
> same flexibility with Maven. Note: the above-mentioned property files
> have to be the entities that specify the user configuration.
>
> Thanks a lot beforehand!
>
> Serge
>
>
>

User Profiles

Posted by Sergei Dubov <sd...@gmail.com>.
I am still trying to get my head around the concept of user profiles 
(using Maven2). Here is what I do in Ant:

1. Let's say we have a project called "leonardo".

2. To work with my Ant process the user is required to have a directory 
called $HOME/.leonardorc and an environment variable called 
$LEONARDO_EXT that contains his current configurational profile.

3. $HOME/.leonardorc contains customer properties files. Let's say:
db.properties.${LEONARDO_EXT}, c3p0.properties.${LEONARDO_EXT}, 
tomcat.properties.${LEONARDO_EXT}. They all contain configurational info 
specific to that user's current profile (set by LEONARD_EXT).

4. The moment a user tries to do something (build, deploy, whatever). 
Some of those files will be copied to the "right" place in the project 
repository, and some will be directly referenced in the Ant build 
script. Of course, the extension of ${LEONARDO_EXT} will be removed upon 
copy.

I'd really appreciate if somebody could explain to me how to achieve the 
same flexibility with Maven. Note: the above-mentioned property files 
have to be the entities that specify the user configuration.

Thanks a lot beforehand!

Serge










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


Re: More: Running Java Progs in Maven 2

Posted by Kaare Nilsen <ka...@gmail.com>.
Hi.. there is added a java goal to the exec plugin, but it is not 100%
finished yet. But if you could wait to over the weekend you will find
what you are looking for

/Kaare

On 15/03/06, Alexandre Poitras <al...@gmail.com> wrote:
> I think it is already possible, look under the third sectio on this page :
> http://mojo.codehaus.org/exec-maven-plugin/introduction.html
>
> On 3/15/06, Sergei Dubov <sd...@gmail.com> wrote:
> > Alexandre,
> >
> > Is it correct that Mojo's exec-maven-plugin will NOT include dependent
> > jars of the project on classpath of a new java process?
> >
> > It'd be nice to have a project, and being able to run:
> >
> > mvn run 'classname'
> >
> > with all the runtime dependencies included on classpath.
> >
> > Is there anything available of this kind?
> >
> > Once again, thanks very much for help.
> >
> > Serge
> >
> > Alexandre Poitras wrote:
> > > On 3/13/06, Sergei Dubov <sd...@gmail.com> wrote:
> > >
> > >>Hi guys,
> > >>
> > >>I am a complete Maven newbie (but a fairly advanced Ant user). I
> > >>attended Jason's presentation at Toronto JUG and was very impressed with
> > >>the value proposition of Maven.
> > >>
> > >>I am still getting my head around the Maven philosophy part. But I do
> > >>keep pushing ahead. :-) A couple of questions that I need answering.
> > >>
> > >>1. I can't seem to find a plugin for running Java progs, akin to Ant's
> > >>java task. And if it is missing, is it appropriate (philosophically
> > >>speaking) to just script an Ant task to the pom.xml?
> > >
> > >
> > > This is what you want :
> > > http://mojo.codehaus.org/exec-maven-plugin/introduction.html
> > >
> > >
> > >>2. I really need to understand how to handle project specific settings
> > >>for each user. Stuff like DB configs, app server specific configuration
> > >>files. Basically 3-4 *.properties files with config info in them.
> > >>
> > >>I appreciate any response.
> > >>
> > >>Thanks!
> > >
> > >
> > > Usually you put the private environnement settings in the settings.xml
> > > using a build profile. But environnement settings related to the
> > > project and not to a particular
> > > developper (a repository declaration for instance) should be kept into
> > > the pom using profile to keep the build portable. It is a good
> > > practice to keep as much information as you can in the project pom
> > > file to keep a consistant and portable build.
> > >
> > > My strategy is to duplicate the environnement settings not specific to
> > > me. I include thoses informations in :
> > >
> > > 1) A super pom file wich is deployed in our internal corporation
> > > repository. All my new projects declare it as their parent. This way I
> > > am sure all the information is recovered and standard across my
> > > projects. When I need to change the settings, I just need to change
> > > the super pom, release a new version on my internal repository and
> > > make sure all my projects use the new version.
> > >
> > > 2) The settings.xml file so I can work without pom when I need it (for
> > > instance to run archetype:create or deploy:deploy-file goals). Just
> > > putting your public environnement settings is not enough, you risk to
> > > have a unportable build if you don't respect #1.
> > >
> > > I suggest you to read attentively this guide. It explains the build
> > > profiles and especially the profiles pitfall I have just mentionned :
> > >
> > > http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> > >
> > > Hope it's help!
> > >
> > >
> > >>Serge
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >>For additional commands, e-mail: users-help@maven.apache.org
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > Alexandre Poitras
> > > Québec, Canada
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> Alexandre Poitras
> Québec, Canada
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: More: Running Java Progs in Maven 2

Posted by Alexandre Poitras <al...@gmail.com>.
I think it is already possible, look under the third sectio on this page :
http://mojo.codehaus.org/exec-maven-plugin/introduction.html

On 3/15/06, Sergei Dubov <sd...@gmail.com> wrote:
> Alexandre,
>
> Is it correct that Mojo's exec-maven-plugin will NOT include dependent
> jars of the project on classpath of a new java process?
>
> It'd be nice to have a project, and being able to run:
>
> mvn run 'classname'
>
> with all the runtime dependencies included on classpath.
>
> Is there anything available of this kind?
>
> Once again, thanks very much for help.
>
> Serge
>
> Alexandre Poitras wrote:
> > On 3/13/06, Sergei Dubov <sd...@gmail.com> wrote:
> >
> >>Hi guys,
> >>
> >>I am a complete Maven newbie (but a fairly advanced Ant user). I
> >>attended Jason's presentation at Toronto JUG and was very impressed with
> >>the value proposition of Maven.
> >>
> >>I am still getting my head around the Maven philosophy part. But I do
> >>keep pushing ahead. :-) A couple of questions that I need answering.
> >>
> >>1. I can't seem to find a plugin for running Java progs, akin to Ant's
> >>java task. And if it is missing, is it appropriate (philosophically
> >>speaking) to just script an Ant task to the pom.xml?
> >
> >
> > This is what you want :
> > http://mojo.codehaus.org/exec-maven-plugin/introduction.html
> >
> >
> >>2. I really need to understand how to handle project specific settings
> >>for each user. Stuff like DB configs, app server specific configuration
> >>files. Basically 3-4 *.properties files with config info in them.
> >>
> >>I appreciate any response.
> >>
> >>Thanks!
> >
> >
> > Usually you put the private environnement settings in the settings.xml
> > using a build profile. But environnement settings related to the
> > project and not to a particular
> > developper (a repository declaration for instance) should be kept into
> > the pom using profile to keep the build portable. It is a good
> > practice to keep as much information as you can in the project pom
> > file to keep a consistant and portable build.
> >
> > My strategy is to duplicate the environnement settings not specific to
> > me. I include thoses informations in :
> >
> > 1) A super pom file wich is deployed in our internal corporation
> > repository. All my new projects declare it as their parent. This way I
> > am sure all the information is recovered and standard across my
> > projects. When I need to change the settings, I just need to change
> > the super pom, release a new version on my internal repository and
> > make sure all my projects use the new version.
> >
> > 2) The settings.xml file so I can work without pom when I need it (for
> > instance to run archetype:create or deploy:deploy-file goals). Just
> > putting your public environnement settings is not enough, you risk to
> > have a unportable build if you don't respect #1.
> >
> > I suggest you to read attentively this guide. It explains the build
> > profiles and especially the profiles pitfall I have just mentionned :
> >
> > http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> >
> > Hope it's help!
> >
> >
> >>Serge
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Alexandre Poitras
> > Québec, Canada
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Alexandre Poitras
Québec, Canada

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


More: Running Java Progs in Maven 2

Posted by Sergei Dubov <sd...@gmail.com>.
Alexandre,

Is it correct that Mojo's exec-maven-plugin will NOT include dependent 
jars of the project on classpath of a new java process?

It'd be nice to have a project, and being able to run:

mvn run 'classname'

with all the runtime dependencies included on classpath.

Is there anything available of this kind?

Once again, thanks very much for help.

Serge

Alexandre Poitras wrote:
> On 3/13/06, Sergei Dubov <sd...@gmail.com> wrote:
> 
>>Hi guys,
>>
>>I am a complete Maven newbie (but a fairly advanced Ant user). I
>>attended Jason's presentation at Toronto JUG and was very impressed with
>>the value proposition of Maven.
>>
>>I am still getting my head around the Maven philosophy part. But I do
>>keep pushing ahead. :-) A couple of questions that I need answering.
>>
>>1. I can't seem to find a plugin for running Java progs, akin to Ant's
>>java task. And if it is missing, is it appropriate (philosophically
>>speaking) to just script an Ant task to the pom.xml?
> 
> 
> This is what you want :
> http://mojo.codehaus.org/exec-maven-plugin/introduction.html
> 
> 
>>2. I really need to understand how to handle project specific settings
>>for each user. Stuff like DB configs, app server specific configuration
>>files. Basically 3-4 *.properties files with config info in them.
>>
>>I appreciate any response.
>>
>>Thanks!
> 
> 
> Usually you put the private environnement settings in the settings.xml
> using a build profile. But environnement settings related to the
> project and not to a particular
> developper (a repository declaration for instance) should be kept into
> the pom using profile to keep the build portable. It is a good
> practice to keep as much information as you can in the project pom
> file to keep a consistant and portable build.
> 
> My strategy is to duplicate the environnement settings not specific to
> me. I include thoses informations in :
> 
> 1) A super pom file wich is deployed in our internal corporation
> repository. All my new projects declare it as their parent. This way I
> am sure all the information is recovered and standard across my
> projects. When I need to change the settings, I just need to change
> the super pom, release a new version on my internal repository and
> make sure all my projects use the new version.
> 
> 2) The settings.xml file so I can work without pom when I need it (for
> instance to run archetype:create or deploy:deploy-file goals). Just
> putting your public environnement settings is not enough, you risk to
> have a unportable build if you don't respect #1.
> 
> I suggest you to read attentively this guide. It explains the build
> profiles and especially the profiles pitfall I have just mentionned :
> 
> http://maven.apache.org/guides/introduction/introduction-to-profiles.html
> 
> Hope it's help!
> 
> 
>>Serge
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> 
> --
> Alexandre Poitras
> Québec, Canada
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

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


Re: Running Java Progs

Posted by Alexandre Poitras <al...@gmail.com>.
On 3/13/06, Sergei Dubov <sd...@gmail.com> wrote:
> Hi guys,
>
> I am a complete Maven newbie (but a fairly advanced Ant user). I
> attended Jason's presentation at Toronto JUG and was very impressed with
> the value proposition of Maven.
>
> I am still getting my head around the Maven philosophy part. But I do
> keep pushing ahead. :-) A couple of questions that I need answering.
>
> 1. I can't seem to find a plugin for running Java progs, akin to Ant's
> java task. And if it is missing, is it appropriate (philosophically
> speaking) to just script an Ant task to the pom.xml?

This is what you want :
http://mojo.codehaus.org/exec-maven-plugin/introduction.html

>
> 2. I really need to understand how to handle project specific settings
> for each user. Stuff like DB configs, app server specific configuration
> files. Basically 3-4 *.properties files with config info in them.
>
> I appreciate any response.
>
> Thanks!

Usually you put the private environnement settings in the settings.xml
using a build profile. But environnement settings related to the
project and not to a particular
developper (a repository declaration for instance) should be kept into
the pom using profile to keep the build portable. It is a good
practice to keep as much information as you can in the project pom
file to keep a consistant and portable build.

My strategy is to duplicate the environnement settings not specific to
me. I include thoses informations in :

1) A super pom file wich is deployed in our internal corporation
repository. All my new projects declare it as their parent. This way I
am sure all the information is recovered and standard across my
projects. When I need to change the settings, I just need to change
the super pom, release a new version on my internal repository and
make sure all my projects use the new version.

2) The settings.xml file so I can work without pom when I need it (for
instance to run archetype:create or deploy:deploy-file goals). Just
putting your public environnement settings is not enough, you risk to
have a unportable build if you don't respect #1.

I suggest you to read attentively this guide. It explains the build
profiles and especially the profiles pitfall I have just mentionned :

http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Hope it's help!

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


--
Alexandre Poitras
Québec, Canada

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