Maven profile properties are not “overriding”

后端 未结 5 1275
忘了有多久
忘了有多久 2021-02-19 10:09

I have Maven multi-module project with such structure:

parent-pom-project

-- module1

-- module2

At the paren

相关标签:
5条回答
  • 2021-02-19 10:41

    You could try to use the mvn help:effective-pom -Ptest command to see the paramters used in your build.

    See http://maven.apache.org/plugins/maven-help-plugin/plugin-info.html for more details.

    0 讨论(0)
  • 2021-02-19 10:42

    Although old I had the same problem and didn't find the solution here. For me the problem was Eclipse which I use parallel to mvn on the command line. Eclipse instantly called process-resources after I did so on the command line.

    Thus the solution was to select the profile in Eclipse (Project->Maven->Select Maven Profiles).

    0 讨论(0)
  • 2021-02-19 10:53

    I resolve problem uninstalling current maven plugin for eclipse and use another one. Now I use this ones: - Maven Integration: http://m2eclipse.sonatype.org/sites/m2e - Maven Integration for WTP: http://m2eclipse.sonatype.org/sites/m2e-extras/

    Early I was using this one http://download.eclipse.org/technology/m2e/releases/. I cannot explain such behavior but may be some configuration was changed by plugin.

    0 讨论(0)
  • 2021-02-19 10:55

    Add a ${basedir} in front of your resource directories:

    <directory>${basedir}/src/main/resources</directory>

    This should fix your problem. My explanation would be that in a multi-module project it's not picking up the path correctly (for within the child module), if you're building from the top-level. Thus when trying to filter, it applies it to a different directory (the actual root-level aggregator), instead of the child.

    I hope it helps.

    0 讨论(0)
  • 2021-02-19 11:01

    I can't figure out how maven can resolve your property if you do not specify any profile. So, to see what's really there, I tried myself, following exactly the schema you described and... I did not experience the problem you have. In your case, it really behaves like if the property was defined outside the profile -as bugske suggested. What happened if you comment temporarily both profiles ?

    0 讨论(0)
提交回复
热议问题