Search code examples
javamavenmaven-release-pluginmaven-profiles

how to disable a maven profile?


I am using maven release plugin. And one profile is just supposed to run on prod build farm. When run on local, it will fail duo to unable to access some web resources.

Maven release plugin will run build on local before tagging, push to remote stuff... But it will fail when run maven release plugin, just because of the profile that only suppose to run on prod build farm.

So I need to disable this profile on local. But the profile is activated by

<os>
    <name>linux</name>
</os>

I tried to use -P !profilename. It works for mvn install but doesn't work for maven release:prepare.

So any way I can specify the os name by command line parameter or disable the profile?


Solution

  • Thanks for all your comments. @uniknow, yes it is needed or there will be an error. But still the profile is not disable in mvn release:prepare...

    Eventually I go with RC's suggestion as a workaround. I removed the activate by os part and using -P to enable the profile on prod.