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?
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)