why maven activation by property doesn't work?










1














I have a maven profile that is activated by a property set up in the same file:



<properties>
<platform>vanilla</platform>
</properties>


<profile>
<id>spark-2.2</id>

<activation>
<property>
<name>platform</name>
<value>vanilla</value>
</property>
</activation>

<modules>
<module>dependency/preload</module>
</modules>
</profile>


however when I run mvn install, the dependency/preload does not appear in the reactor build sequence which eventual leads to a compilation error. Why the property in the same file is useless and what should I do to fix it?










share|improve this question

















  • 1




    Possible duplicate of this question.
    – user944849
    Nov 12 '18 at 21:30











  • Possible duplicate of Maven: property to activate profile in sub-modules
    – pirho
    Nov 13 '18 at 6:12















1














I have a maven profile that is activated by a property set up in the same file:



<properties>
<platform>vanilla</platform>
</properties>


<profile>
<id>spark-2.2</id>

<activation>
<property>
<name>platform</name>
<value>vanilla</value>
</property>
</activation>

<modules>
<module>dependency/preload</module>
</modules>
</profile>


however when I run mvn install, the dependency/preload does not appear in the reactor build sequence which eventual leads to a compilation error. Why the property in the same file is useless and what should I do to fix it?










share|improve this question

















  • 1




    Possible duplicate of this question.
    – user944849
    Nov 12 '18 at 21:30











  • Possible duplicate of Maven: property to activate profile in sub-modules
    – pirho
    Nov 13 '18 at 6:12













1












1








1







I have a maven profile that is activated by a property set up in the same file:



<properties>
<platform>vanilla</platform>
</properties>


<profile>
<id>spark-2.2</id>

<activation>
<property>
<name>platform</name>
<value>vanilla</value>
</property>
</activation>

<modules>
<module>dependency/preload</module>
</modules>
</profile>


however when I run mvn install, the dependency/preload does not appear in the reactor build sequence which eventual leads to a compilation error. Why the property in the same file is useless and what should I do to fix it?










share|improve this question













I have a maven profile that is activated by a property set up in the same file:



<properties>
<platform>vanilla</platform>
</properties>


<profile>
<id>spark-2.2</id>

<activation>
<property>
<name>platform</name>
<value>vanilla</value>
</property>
</activation>

<modules>
<module>dependency/preload</module>
</modules>
</profile>


however when I run mvn install, the dependency/preload does not appear in the reactor build sequence which eventual leads to a compilation error. Why the property in the same file is useless and what should I do to fix it?







maven maven-3 maven-profiles






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 19:55









tribbloid

1,89752651




1,89752651







  • 1




    Possible duplicate of this question.
    – user944849
    Nov 12 '18 at 21:30











  • Possible duplicate of Maven: property to activate profile in sub-modules
    – pirho
    Nov 13 '18 at 6:12












  • 1




    Possible duplicate of this question.
    – user944849
    Nov 12 '18 at 21:30











  • Possible duplicate of Maven: property to activate profile in sub-modules
    – pirho
    Nov 13 '18 at 6:12







1




1




Possible duplicate of this question.
– user944849
Nov 12 '18 at 21:30





Possible duplicate of this question.
– user944849
Nov 12 '18 at 21:30













Possible duplicate of Maven: property to activate profile in sub-modules
– pirho
Nov 13 '18 at 6:12




Possible duplicate of Maven: property to activate profile in sub-modules
– pirho
Nov 13 '18 at 6:12












1 Answer
1






active

oldest

votes


















1














Would there be any point to have that working? Why would you fix it statically to same the pom?



Usually when you have many profiles you might want to have one as:



<activation>
<activeByDefault>true</activeByDefault>
</activation>


but of course not necessarily. The other profiles are then triggered explicitly or the few way presented later.



I have attached below parts from Introduction to Build Profiles




A profile can be triggered/activated in several ways:



  • Explicitly

  • Through Maven settings

  • Based on environment variables

  • OS settings

  • Present or missing files



The part environment variables is the part that I think you are trying to make use. And to have it a bit more confusing it is later referred as system property. So it is a system property. Later on the same document you will see the usage:



<activation>
<property>
<name>debug</name>
</property>
</activation>


will activate by (for example):



mvn install -Ddebug


However, for example, following does not work:



export debug=true
mvn install


So why the pom properties are not applied as a system property or any property. I think it is because profile should be able to override pom property values that could then be considered as default values.



Yet later on same doc, few lines:




Profiles in POMs

...

Profiles specified in the POM can modify the following POM elements:

...

<properties> (not actually available in the main POM, but used behind the scenes)







share|improve this answer






















  • <activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
    – tribbloid
    Nov 12 '18 at 22:51










  • This is one of the many landmines setup by maven developers
    – tribbloid
    Nov 12 '18 at 22:51










  • also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
    – tribbloid
    Nov 12 '18 at 22:53










  • 1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
    – pirho
    Nov 13 '18 at 5:56










  • thanks a lot, despite being not the most optimal option I'll accept it
    – tribbloid
    Dec 23 '18 at 23:38










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269212%2fwhy-maven-activation-by-property-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Would there be any point to have that working? Why would you fix it statically to same the pom?



Usually when you have many profiles you might want to have one as:



<activation>
<activeByDefault>true</activeByDefault>
</activation>


but of course not necessarily. The other profiles are then triggered explicitly or the few way presented later.



I have attached below parts from Introduction to Build Profiles




A profile can be triggered/activated in several ways:



  • Explicitly

  • Through Maven settings

  • Based on environment variables

  • OS settings

  • Present or missing files



The part environment variables is the part that I think you are trying to make use. And to have it a bit more confusing it is later referred as system property. So it is a system property. Later on the same document you will see the usage:



<activation>
<property>
<name>debug</name>
</property>
</activation>


will activate by (for example):



mvn install -Ddebug


However, for example, following does not work:



export debug=true
mvn install


So why the pom properties are not applied as a system property or any property. I think it is because profile should be able to override pom property values that could then be considered as default values.



Yet later on same doc, few lines:




Profiles in POMs

...

Profiles specified in the POM can modify the following POM elements:

...

<properties> (not actually available in the main POM, but used behind the scenes)







share|improve this answer






















  • <activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
    – tribbloid
    Nov 12 '18 at 22:51










  • This is one of the many landmines setup by maven developers
    – tribbloid
    Nov 12 '18 at 22:51










  • also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
    – tribbloid
    Nov 12 '18 at 22:53










  • 1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
    – pirho
    Nov 13 '18 at 5:56










  • thanks a lot, despite being not the most optimal option I'll accept it
    – tribbloid
    Dec 23 '18 at 23:38















1














Would there be any point to have that working? Why would you fix it statically to same the pom?



Usually when you have many profiles you might want to have one as:



<activation>
<activeByDefault>true</activeByDefault>
</activation>


but of course not necessarily. The other profiles are then triggered explicitly or the few way presented later.



I have attached below parts from Introduction to Build Profiles




A profile can be triggered/activated in several ways:



  • Explicitly

  • Through Maven settings

  • Based on environment variables

  • OS settings

  • Present or missing files



The part environment variables is the part that I think you are trying to make use. And to have it a bit more confusing it is later referred as system property. So it is a system property. Later on the same document you will see the usage:



<activation>
<property>
<name>debug</name>
</property>
</activation>


will activate by (for example):



mvn install -Ddebug


However, for example, following does not work:



export debug=true
mvn install


So why the pom properties are not applied as a system property or any property. I think it is because profile should be able to override pom property values that could then be considered as default values.



Yet later on same doc, few lines:




Profiles in POMs

...

Profiles specified in the POM can modify the following POM elements:

...

<properties> (not actually available in the main POM, but used behind the scenes)







share|improve this answer






















  • <activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
    – tribbloid
    Nov 12 '18 at 22:51










  • This is one of the many landmines setup by maven developers
    – tribbloid
    Nov 12 '18 at 22:51










  • also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
    – tribbloid
    Nov 12 '18 at 22:53










  • 1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
    – pirho
    Nov 13 '18 at 5:56










  • thanks a lot, despite being not the most optimal option I'll accept it
    – tribbloid
    Dec 23 '18 at 23:38













1












1








1






Would there be any point to have that working? Why would you fix it statically to same the pom?



Usually when you have many profiles you might want to have one as:



<activation>
<activeByDefault>true</activeByDefault>
</activation>


but of course not necessarily. The other profiles are then triggered explicitly or the few way presented later.



I have attached below parts from Introduction to Build Profiles




A profile can be triggered/activated in several ways:



  • Explicitly

  • Through Maven settings

  • Based on environment variables

  • OS settings

  • Present or missing files



The part environment variables is the part that I think you are trying to make use. And to have it a bit more confusing it is later referred as system property. So it is a system property. Later on the same document you will see the usage:



<activation>
<property>
<name>debug</name>
</property>
</activation>


will activate by (for example):



mvn install -Ddebug


However, for example, following does not work:



export debug=true
mvn install


So why the pom properties are not applied as a system property or any property. I think it is because profile should be able to override pom property values that could then be considered as default values.



Yet later on same doc, few lines:




Profiles in POMs

...

Profiles specified in the POM can modify the following POM elements:

...

<properties> (not actually available in the main POM, but used behind the scenes)







share|improve this answer














Would there be any point to have that working? Why would you fix it statically to same the pom?



Usually when you have many profiles you might want to have one as:



<activation>
<activeByDefault>true</activeByDefault>
</activation>


but of course not necessarily. The other profiles are then triggered explicitly or the few way presented later.



I have attached below parts from Introduction to Build Profiles




A profile can be triggered/activated in several ways:



  • Explicitly

  • Through Maven settings

  • Based on environment variables

  • OS settings

  • Present or missing files



The part environment variables is the part that I think you are trying to make use. And to have it a bit more confusing it is later referred as system property. So it is a system property. Later on the same document you will see the usage:



<activation>
<property>
<name>debug</name>
</property>
</activation>


will activate by (for example):



mvn install -Ddebug


However, for example, following does not work:



export debug=true
mvn install


So why the pom properties are not applied as a system property or any property. I think it is because profile should be able to override pom property values that could then be considered as default values.



Yet later on same doc, few lines:




Profiles in POMs

...

Profiles specified in the POM can modify the following POM elements:

...

<properties> (not actually available in the main POM, but used behind the scenes)








share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 '18 at 6:10

























answered Nov 12 '18 at 21:05









pirho

3,716101830




3,716101830











  • <activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
    – tribbloid
    Nov 12 '18 at 22:51










  • This is one of the many landmines setup by maven developers
    – tribbloid
    Nov 12 '18 at 22:51










  • also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
    – tribbloid
    Nov 12 '18 at 22:53










  • 1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
    – pirho
    Nov 13 '18 at 5:56










  • thanks a lot, despite being not the most optimal option I'll accept it
    – tribbloid
    Dec 23 '18 at 23:38
















  • <activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
    – tribbloid
    Nov 12 '18 at 22:51










  • This is one of the many landmines setup by maven developers
    – tribbloid
    Nov 12 '18 at 22:51










  • also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
    – tribbloid
    Nov 12 '18 at 22:53










  • 1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
    – pirho
    Nov 13 '18 at 5:56










  • thanks a lot, despite being not the most optimal option I'll accept it
    – tribbloid
    Dec 23 '18 at 23:38















<activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
– tribbloid
Nov 12 '18 at 22:51




<activeByDefault>true</activeByDefault> is useless as it becomes deactivated once another profile is setup, see stackoverflow.com/questions/5309379/…
– tribbloid
Nov 12 '18 at 22:51












This is one of the many landmines setup by maven developers
– tribbloid
Nov 12 '18 at 22:51




This is one of the many landmines setup by maven developers
– tribbloid
Nov 12 '18 at 22:51












also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
– tribbloid
Nov 12 '18 at 22:53




also, system property and environment variable are apple and orange (if you ask anyone working on java for some time)
– tribbloid
Nov 12 '18 at 22:53












1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
– pirho
Nov 13 '18 at 5:56




1. Usefulness depends on the case. 2. Yes, docs could be more clear. 3. Might be but that is just what there reads in the docs. See the small update on the answer (soon).
– pirho
Nov 13 '18 at 5:56












thanks a lot, despite being not the most optimal option I'll accept it
– tribbloid
Dec 23 '18 at 23:38




thanks a lot, despite being not the most optimal option I'll accept it
– tribbloid
Dec 23 '18 at 23:38

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269212%2fwhy-maven-activation-by-property-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党