You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Billy Newman <ne...@gmail.com> on 2012/11/03 20:52:44 UTC

profile help

I have the following 'main' profiles setup for my build:
'lite'
'complete'

I also have another that can optionally be built as part of either of those
main builds, 'optional'

I have setup up an 'optional' profile.  I can build either build alone or
either build with the optional profile too.

mvn clean install lite
mvn clean install complete
mvn clean install lite,optional
mven clean install complete,optional

My problem stems from my optional build needing to know about which 'main'
profile I am building.  I.E. basically I will end up with a lite and
'lite-optional' or complete and 'complete-optional'.  Do I really need to
setup two different 'optional' profiles (lite-optional and
complete-optional) such that my optional build knows it lite or complete?
In the end it amounts to the optional build needing to pick the 'right'
file to deploy in the war based on lite or complete.  I don't think when I
am building the optional portion of the build I can get at the 'main'
profile that I am running since it is just one of the profiles.

Maybe I am just thinking about this wrong.  Hoping someone can provide some
insight or a good idea.

As always, thanks again.

Re: profile help

Posted by Curtis Rueden <ct...@wisc.edu>.
Hi Billy,

> mvn clean install lite,optional

Presumably you mean:
   mvn -P lite,optional clean install
?

> Do I really need to setup two different 'optional' profiles
> (lite-optional and complete-optional) such that my optional build
> knows it lite or complete?

That really depends on what each profile is changing about your
configuration.

In many cases, no, you can have profiles that set a system property in
different ways, then use that property in place of a hardcoded value. But
in some cases that approach won't work.

> In the end it amounts to the optional build needing to pick the
> 'right' file to deploy in the war based on lite or complete.

In that case, the system property approach should work. Just set the name
of the file as appropriate in each profile.

If you need further advice, I suggest posting your POM (gist, pastebin,
etc.) so that others can see what you are trying to do.

Regards,
Curtis


On Sat, Nov 3, 2012 at 2:52 PM, Billy Newman <ne...@gmail.com> wrote:

> I have the following 'main' profiles setup for my build:
> 'lite'
> 'complete'
>
> I also have another that can optionally be built as part of either of those
> main builds, 'optional'
>
> I have setup up an 'optional' profile.  I can build either build alone or
> either build with the optional profile too.
>
> mvn clean install lite
> mvn clean install complete
> mvn clean install lite,optional
> mven clean install complete,optional
>
> My problem stems from my optional build needing to know about which 'main'
> profile I am building.  I.E. basically I will end up with a lite and
> 'lite-optional' or complete and 'complete-optional'.  Do I really need to
> setup two different 'optional' profiles (lite-optional and
> complete-optional) such that my optional build knows it lite or complete?
> In the end it amounts to the optional build needing to pick the 'right'
> file to deploy in the war based on lite or complete.  I don't think when I
> am building the optional portion of the build I can get at the 'main'
> profile that I am running since it is just one of the profiles.
>
> Maybe I am just thinking about this wrong.  Hoping someone can provide some
> insight or a good idea.
>
> As always, thanks again.
>