简体   繁体   中英

Maven - Profile&Modules - Activation by property?

Could someone help me understand this issue below? Approach #1 below works as expected, when the IDE asks maven to build the project it rebuilds moduleA and include it as a dependency; everybody happy. Approach #2 which is what I want to use does not behave the same way, myProperty is a system property I've defined and toggling it between true/false does activate the profile BUT it does not build moduleA, why?

#1

...
<profiles>
   <profile>
      <id>testProfile</id>
      <activation>
         <activationByDefault>true</activationByDefault>
      </activation>
   </profile>
   <modules>
      <module>../moduleA</module>
   </modules>
</profiles>
...

#2

...
<profiles>
   <profile>
      <id>testProfile</id>
      <activation>
         <property>
            <name>myProperty</name>
            <value>true</value>
         </property>
      </activation>
   </profile>
   <modules>
      <module>../moduleA</module>
   </modules>
</profiles>
...

Oh, after hours up and down the documentation I found my problem. Was not aware that the name of the config file mattered, so I had named it jvm.config as I saw the bash script looked after such a file for maven options. Apparently it was supposed to be in maven.config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM