Maven - Can I reference profile id in profile definition?

后端 未结 3 1504
盖世英雄少女心
盖世英雄少女心 2020-12-09 14:28

I\'ve set profiles in a pom.xml, like shown as follows:


profileId1
             


        
3条回答
  •  无人及你
    2020-12-09 15:21

    With maven 2.2.1 and later, I was able to get the ID of the first active profile using:

    ${project.activeProfiles[0].id}
    

    Of course this fails if there is not a least one active profile.

    Using the

    ${project.profiles[0].id}
    

    as suggested by Pascal did not work for me.

    Hint: While investigating this, I really started to love mvn help:evaluate.

提交回复
热议问题