You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by DariusX <da...@gmail.com> on 2017/06/06 03:29:14 UTC
Using files to activate Maven profiles
On a micro-service leaning project, I have various modules that share certain
common aspects among them but not everything. For instance, 5 modules may
require Swagger-UI to be downloaded and unzipped into my target/webapp. Some
other grouping of 5 modules may require something else.
There no neat hierarchy "under" the parent POM, so I'm considering this
approach:
1. Create profiles in the parent POM to define certain aspects within the
build
2. Activate each profile, by the presence of a specific "indicator" file
3. In any sub-project that needs a specific feature, create the relevant
indicator file
4. Maybe I'll have a main/maven directory, as a place to keep indicator
files
I'm looking for thoughts of the pros and cons of this approach. I'd also
like to know if there's a more idiomatic approach.
--
View this message in context: http://maven.40175.n5.nabble.com/Using-files-to-activate-Maven-profiles-tp5909557.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Using files to activate Maven profiles
Posted by Jörg Schaible <jo...@bpm-inspire.com>.
Hi Darius,
DariusX wrote:
> On a micro-service leaning project, I have various modules that share
> certain common aspects among them but not everything. For instance, 5
> modules may require Swagger-UI to be downloaded and unzipped into my
> target/webapp. Some other grouping of 5 modules may require something
> else.
>
> There no neat hierarchy "under" the parent POM, so I'm considering this
> approach:
>
> 1. Create profiles in the parent POM to define certain aspects within the
> build
> 2. Activate each profile, by the presence of a specific "indicator" file
> 3. In any sub-project that needs a specific feature, create the relevant
> indicator file
> 4. Maybe I'll have a main/maven directory, as a place to keep indicator
> files
>
> I'm looking for thoughts of the pros and cons of this approach. I'd also
> like to know if there's a more idiomatic approach.
Activating profiles based on file existance is a neat solution for build
variations and in the meanwhile often used in the way you're describing it
above. However, you should never use profiles to manage dependencies. That's
a recipe for desaster for consumers of your artifacts. Note, the file that
triggers the profile exists only at build time...
Cheers,
Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org