You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Kramer <jk...@mojiva.com> on 2012/08/28 21:25:33 UTC

Use of Profiles

Hello to all,

I am not exactly new to maven, but I haven't had any formal training and am certainly not as experienced as many in this audience.

I have been on this mailing list for a few weeks and have noticed a lot of talk about profiles and why they should not be used.

I wanted to share with you the way in which I have successfully used profiles without ever experiencing any pain.  First, I don't use profiles to build separate artifacts.  I only use them to do other activities.  Mostly I use them to run certain tests.  That way, a particular invocation can run tests that hit the database when that is appropriate.  Also, sometimes I use them to do other activities such as deploy a schema to a database or start a server … again mostly as a way to prep an environment for running tests.

Is that the way in which profiles should be used?  I imagine that most of the pain people experience come from different artifacts being built with the same ids.  Is that correct?

I'd love to hear what you all think. Thanks for your time.


John Kramer
email: jkramer@mojiva.com<ma...@mojiva.com>
mobile: 314.435.2370
skype: kramer.mojiva
twitter: @KramerKnowsTech<https://twitter.com/KramerKnowsTech>
0xCAFEBABE00000032


Re: Use of Profiles

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

> I imagine that most of the pain people experience come from different
> artifacts being built with the same ids.

Yep, one huge advantage of a well-structured Maven project is a repeatable
build, even across multiple platforms. Anything that violates that is
generally frowned upon. This includes profiles that fiddle with
dependencies, deprecated features like the "RELEASE" and "LATEST" version
keywords, and evil use of properties derived from external sources such as
system properties. The rationale is that it is really nasty to publish a
"release" that builds differently in different situations; if your project
depends on my release, you are counting on it being a stable binary.

That said, profiles are great for executing different test suites or
application configurations. My project (http://github.com/imagej/imagej) uses
them to allow execution of the end user application with different user
interfaces, triggered by a system property (see
https://github.com/imagej/imagej/blob/5acf4512/app/pom.xml#L332;
http://developer.imagej.net/command-line).

They are also nice for building certain secondary artifacts, such as an
application bundle or uber-JAR (
https://github.com/imagej/imagej/blob/5acf4512/app/pom.xml#L381). Of
course, the build with that profile enabled should still be repeatable,
too, though.

Regards,
Curtis


On Tue, Aug 28, 2012 at 2:25 PM, John Kramer <jk...@mojiva.com> wrote:

> Hello to all,
>
> I am not exactly new to maven, but I haven't had any formal training and
> am certainly not as experienced as many in this audience.
>
> I have been on this mailing list for a few weeks and have noticed a lot of
> talk about profiles and why they should not be used.
>
> I wanted to share with you the way in which I have successfully used
> profiles without ever experiencing any pain.  First, I don't use profiles
> to build separate artifacts.  I only use them to do other activities.
>  Mostly I use them to run certain tests.  That way, a particular invocation
> can run tests that hit the database when that is appropriate.  Also,
> sometimes I use them to do other activities such as deploy a schema to a
> database or start a server … again mostly as a way to prep an environment
> for running tests.
>
> Is that the way in which profiles should be used?  I imagine that most of
> the pain people experience come from different artifacts being built with
> the same ids.  Is that correct?
>
> I'd love to hear what you all think. Thanks for your time.
>
>
> John Kramer
> email: jkramer@mojiva.com<ma...@mojiva.com>
> mobile: 314.435.2370
> skype: kramer.mojiva
> twitter: @KramerKnowsTech<https://twitter.com/KramerKnowsTech>
> 0xCAFEBABE00000032
>
>