You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Eric Kolotyluk <er...@gmail.com> on 2013/03/23 01:51:16 UTC

activeProfiles

I have two development environments: work and personal.

I am trying to set up my projects so that the POM knows which profile to 
activate, but it seems you cannot put <activeProfiles> in a POM, only in 
a settings.xml file. Is there some reason for this?

Is there some other Maven way to do what I want to do? How do other 
people separate work development from personal development?

Cheers, Eric

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


Re: activeProfiles

Posted by Eric Kolotyluk <er...@gmail.com>.
Sweet!

I was wondering if there was some way to activate a profile 
conditionally. Can the property be defined in a pom.xml, or does it have 
to be defined elsewhere.?

Cheers, Eric

On 2013-03-24 7:46 AM, Robert Scholte wrote:
> For our mojo-projects we often have a profile for integration-tests, 
> which is active by default with the following trick:
>       <activation>
>         <property>
>           <name>skipTests</name>
>           <value>!true</value>
>         </property>
>       </activation>
>
> This means that if and only if there's a property skipTests and its 
> value is true, the profile is deactivated.
>
> Robert
>
> Op Sun, 24 Mar 2013 15:41:57 +0100 schreef Eric Kolotyluk 
> <er...@gmail.com>:
>
>> I was trying to avoid having two setting.xml files. I was also 
>> thinking of
>> having two login accounts each with their own settings.xml as role based
>> login makes more sense. Thanks for confirming my thinking.
>>
>> Seriously too bad that <activeProfiles> cannot be in a pom.xml file.
>>
>> Cheers, Eric
>> On Mar 23, 2013 7:15 AM, "Wayne Fay" <wa...@gmail.com> wrote:
>>
>>> > I am trying to set up my projects so that the POM knows which 
>>> profile to
>>> > activate, but it seems you cannot put <activeProfiles> in a POM, 
>>> only in
>>> a
>>> > settings.xml file. Is there some reason for this?
>>> >
>>> > Is there some other Maven way to do what I want to do? How do other
>>> people
>>> > separate work development from personal development?
>>>
>>> One technique I've employed uses two settings.xml files. First you 
>>> should
>>> know about the -s option when calling mvn, look it up. Copy mvn.bat to
>>> mvnp.bat and mvnw.bat (or .sh). In mvnp.bat, specify -s
>>> settings-personal.xml and in mvnw.bat, specify -s settings-work.xml.
>>>
>>> Then call mvnw or mvnp instead of mvn. You can also adjust mvn.bat 
>>> directly
>>> and use that for personal (or work, whichever is most common).
>>>
>>> Or just set up another user account and log in/out depending on what 
>>> you
>>> are working on, each with its own settings.xml. This is easier on
>>> Linux/Unix.
>>>
>>> Wayne
>
> ---------------------------------------------------------------------
> 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: activeProfiles

Posted by Robert Scholte <rf...@apache.org>.
For our mojo-projects we often have a profile for integration-tests, which  
is active by default with the following trick:
       <activation>
         <property>
           <name>skipTests</name>
           <value>!true</value>
         </property>
       </activation>

This means that if and only if there's a property skipTests and its value  
is true, the profile is deactivated.

Robert

Op Sun, 24 Mar 2013 15:41:57 +0100 schreef Eric Kolotyluk  
<er...@gmail.com>:

> I was trying to avoid having two setting.xml files. I was also thinking  
> of
> having two login accounts each with their own settings.xml as role based
> login makes more sense. Thanks for confirming my thinking.
>
> Seriously too bad that <activeProfiles> cannot be in a pom.xml file.
>
> Cheers, Eric
> On Mar 23, 2013 7:15 AM, "Wayne Fay" <wa...@gmail.com> wrote:
>
>> > I am trying to set up my projects so that the POM knows which profile  
>> to
>> > activate, but it seems you cannot put <activeProfiles> in a POM, only  
>> in
>> a
>> > settings.xml file. Is there some reason for this?
>> >
>> > Is there some other Maven way to do what I want to do? How do other
>> people
>> > separate work development from personal development?
>>
>> One technique I've employed uses two settings.xml files. First you  
>> should
>> know about the -s option when calling mvn, look it up. Copy mvn.bat to
>> mvnp.bat and mvnw.bat (or .sh). In mvnp.bat, specify -s
>> settings-personal.xml and in mvnw.bat, specify -s settings-work.xml.
>>
>> Then call mvnw or mvnp instead of mvn. You can also adjust mvn.bat  
>> directly
>> and use that for personal (or work, whichever is most common).
>>
>> Or just set up another user account and log in/out depending on what you
>> are working on, each with its own settings.xml. This is easier on
>> Linux/Unix.
>>
>> Wayne

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


Re: activeProfiles

Posted by Joachim Van der Auwera <jo...@progs.be>.
I adjusted my maven startup script to automatically use project specific 
settings.xml file:
see http://blog.progs.be/311/project-specific-maven-settings-xml

Kind regards,
Joachim

On 03/24/2013 05:25 PM, Wayne Fay wrote:
>> I was trying to avoid having two setting.xml files. I was also thinking of
>> having two login accounts each with their own settings.xml as role based
>> login makes more sense. Thanks for confirming my thinking.
> Even better is using a VM for your work environment on the personal
> machine. This is what I do the last few years. I have a buddy who has
> Mountain Lion VMs hosted (Parallels) on his ML machine. He has a
> "financial" VM for banking and taxes, a "work" VM for work stuff, etc.
>
> Wayne
>
> ---------------------------------------------------------------------
> 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: activeProfiles

Posted by Eric Kolotyluk <er...@gmail.com>.
Yes, I have VMWare Workstation 9.

I can get our IT department to give me an image so I can join the work 
domain.

Excellent suggestion :-)

Cheers, Eric

On 2013-03-24 9:25 AM, Wayne Fay wrote:
>> I was trying to avoid having two setting.xml files. I was also thinking of
>> having two login accounts each with their own settings.xml as role based
>> login makes more sense. Thanks for confirming my thinking.
> Even better is using a VM for your work environment on the personal
> machine. This is what I do the last few years. I have a buddy who has
> Mountain Lion VMs hosted (Parallels) on his ML machine. He has a
> "financial" VM for banking and taxes, a "work" VM for work stuff, etc.
>
> Wayne
>
> ---------------------------------------------------------------------
> 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: activeProfiles

Posted by Wayne Fay <wa...@gmail.com>.
> I was trying to avoid having two setting.xml files. I was also thinking of
> having two login accounts each with their own settings.xml as role based
> login makes more sense. Thanks for confirming my thinking.

Even better is using a VM for your work environment on the personal
machine. This is what I do the last few years. I have a buddy who has
Mountain Lion VMs hosted (Parallels) on his ML machine. He has a
"financial" VM for banking and taxes, a "work" VM for work stuff, etc.

Wayne

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


Re: activeProfiles

Posted by Eric Kolotyluk <er...@gmail.com>.
I was trying to avoid having two setting.xml files. I was also thinking of
having two login accounts each with their own settings.xml as role based
login makes more sense. Thanks for confirming my thinking.

Seriously too bad that <activeProfiles> cannot be in a pom.xml file.

Cheers, Eric
On Mar 23, 2013 7:15 AM, "Wayne Fay" <wa...@gmail.com> wrote:

> > I am trying to set up my projects so that the POM knows which profile to
> > activate, but it seems you cannot put <activeProfiles> in a POM, only in
> a
> > settings.xml file. Is there some reason for this?
> >
> > Is there some other Maven way to do what I want to do? How do other
> people
> > separate work development from personal development?
>
> One technique I've employed uses two settings.xml files. First you should
> know about the -s option when calling mvn, look it up. Copy mvn.bat to
> mvnp.bat and mvnw.bat (or .sh). In mvnp.bat, specify -s
> settings-personal.xml and in mvnw.bat, specify -s settings-work.xml.
>
> Then call mvnw or mvnp instead of mvn. You can also adjust mvn.bat directly
> and use that for personal (or work, whichever is most common).
>
> Or just set up another user account and log in/out depending on what you
> are working on, each with its own settings.xml. This is easier on
> Linux/Unix.
>
> Wayne
>

activeProfiles

Posted by Wayne Fay <wa...@gmail.com>.
> I am trying to set up my projects so that the POM knows which profile to
> activate, but it seems you cannot put <activeProfiles> in a POM, only in a
> settings.xml file. Is there some reason for this?
>
> Is there some other Maven way to do what I want to do? How do other people
> separate work development from personal development?

One technique I've employed uses two settings.xml files. First you should
know about the -s option when calling mvn, look it up. Copy mvn.bat to
mvnp.bat and mvnw.bat (or .sh). In mvnp.bat, specify -s
settings-personal.xml and in mvnw.bat, specify -s settings-work.xml.

Then call mvnw or mvnp instead of mvn. You can also adjust mvn.bat directly
and use that for personal (or work, whichever is most common).

Or just set up another user account and log in/out depending on what you
are working on, each with its own settings.xml. This is easier on
Linux/Unix.

Wayne

Re: activeProfiles

Posted by Eric Kolotyluk <er...@gmail.com>.
On Mon, Mar 25, 2013 at 7:14 AM, Jörg Schaible <jo...@gmx.de>wrote:

> Eric Kolotyluk wrote:
>
> >
> > On 2013-03-25 3:49 AM, Jörg Schaible wrote:
> >> Hi Eric,
> >>
> >> Eric Kolotyluk wrote:
> >>
> >>> I have two development environments: work and personal.
> >>>
> >>> I am trying to set up my projects so that the POM knows which profile
> to
> >>> activate, but it seems you cannot put <activeProfiles> in a POM, only
> in
> >>> a settings.xml file. Is there some reason for this?
> >>>
> >>> Is there some other Maven way to do what I want to do? How do other
> >>> people separate work development from personal development?
> >> What's the problem with it? If you active a profile in the settings.xml,
> >> you can use this profile (i.e. a profile with same name) also in your
> >> POMs, you don't need an activation anymore.
>
> actually I don't get why a separate VM is preferable to a second
> settings.xml in this case - if we still only talk about Maven ;-)
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Personal preference. For me it makes more sense to just work in a specific
role or environment for all my work.

Having to manage multiple settings files leads to complexity, mistakes, and
frustration. I don't want to have use Maven with more options than I need
to. I really believe in convention over configuration, and multiple
settings.xml files violates that principle.

Cheers, Eric

Re: activeProfiles

Posted by Jörg Schaible <jo...@gmx.de>.
Eric Kolotyluk wrote:

> 
> On 2013-03-25 3:49 AM, Jörg Schaible wrote:
>> Hi Eric,
>>
>> Eric Kolotyluk wrote:
>>
>>> I have two development environments: work and personal.
>>>
>>> I am trying to set up my projects so that the POM knows which profile to
>>> activate, but it seems you cannot put <activeProfiles> in a POM, only in
>>> a settings.xml file. Is there some reason for this?
>>>
>>> Is there some other Maven way to do what I want to do? How do other
>>> people separate work development from personal development?
>> What's the problem with it? If you active a profile in the settings.xml,
>> you can use this profile (i.e. a profile with same name) also in your
>> POMs, you don't need an activation anymore.

actually I don't get why a separate VM is preferable to a second 
settings.xml in this case - if we still only talk about Maven ;-)

- Jörg


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


Re: activeProfiles

Posted by Eric Kolotyluk <er...@gmail.com>.
On 2013-03-25 3:49 AM, Jörg Schaible wrote:
> Hi Eric,
>
> Eric Kolotyluk wrote:
>
>> I have two development environments: work and personal.
>>
>> I am trying to set up my projects so that the POM knows which profile to
>> activate, but it seems you cannot put <activeProfiles> in a POM, only in
>> a settings.xml file. Is there some reason for this?
>>
>> Is there some other Maven way to do what I want to do? How do other
>> people separate work development from personal development?
> What's the problem with it? If you active a profile in the settings.xml, you
> can use this profile (i.e. a profile with same name) also in your POMs, you
> don't need an activation anymore.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

What I wanted to do was uses the same settings.xml for work and personal 
development. For example, I have to profiles

 1. nexus-kodak
 2. nexus-kolotyluk

The first uses the settings for our nexus server at Kodak, while the 
second uses my personal nexus server. I wanted to be able to put

   <activeProfiles>
     <activeProfile>nexus-kodak</activeProfile>
   </activeProfiles>

In the parent POM of my Kodak projects, and put

   <activeProfiles>
     <activeProfile>nexus-kolotyluk</activeProfile>
   </activeProfiles>

in the parent POM of my personal projects.

In the end I have been convinced that when working from home, to use a 
separate Virtual Machine for all my work related development at home, 
which creates a cleaner separation between work and home.

Cheers, Eric

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


Re: activeProfiles

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Eric,

Eric Kolotyluk wrote:

> I have two development environments: work and personal.
> 
> I am trying to set up my projects so that the POM knows which profile to
> activate, but it seems you cannot put <activeProfiles> in a POM, only in
> a settings.xml file. Is there some reason for this?
> 
> Is there some other Maven way to do what I want to do? How do other
> people separate work development from personal development?

What's the problem with it? If you active a profile in the settings.xml, you 
can use this profile (i.e. a profile with same name) also in your POMs, you 
don't need an activation anymore.

- Jörg


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