Inherited profiles in Maven

前端 未结 5 958
夕颜
夕颜 2020-12-15 11:07

I have the following profiles in my parent pom


    P1
    
        true         


        
5条回答
  •  不知归路
    2020-12-15 11:25

    Just to clarify on this, Maven Profiles are in fact inherited. For a reference to another SO question see: Inheriting Maven profiles. I have successfully inherited profiles in my project and no additional work is needed.

    As for the original question, you have a variable defined in the exists element. According to the documentation:

    As of Maven 2.0.9, the tags and could be interpolated. Supported variables are system properties like ${user.home} and environment variables like ${env.HOME}. Please note that properties and values defined in the POM itself are not available for interpolation here, e.g. the above example activator cannot use ${project.build.directory} but needs to hard-code the path target.

    So, what I get from that is that ${project.basedir} cannot be used and will not work. If however you have it defined as an environment variable, it will work.

    One caveat that I found is that in the parent pom should be used to configure the plugins. However, for within the profiles I find that must not be used in order for the profile-specific configuration to work.

提交回复
热议问题