Inheriting Maven profiles

2019-01-22 18:22发布

Is it possible for a child POM to inherit profiles defined in the parent POM? If so, how?

4条回答
爷、活的狠高调
2楼-- · 2019-01-22 18:29

I don't think it is inherited. http://www.dashbay.com/2011/03/maven-profile-inheritance/ http://looking4q.blogspot.com/2011/01/maven-profiles-inheritance.html You may find the profiles available is very likely because they are activated by default

查看更多
萌系小妹纸
3楼-- · 2019-01-22 18:36

I tested profile inheritanced with maven 3.3.9. If the parent pom declares the child module (aggregation), the profile is visible in the child module. If the parent pom does not declare de child module (inheritance), the profile is not visible.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-22 18:42

Profiles defined in a parent POM are inherited in a child POM extending the parent, there is nothing to do. And just in case, the Maven Help Plugin has very useful goals allowing to deal with profiles:

查看更多
【Aperson】
5楼-- · 2019-01-22 18:45

It's not just possible, it's mandatory. If you declare a parent POM, you get all its profiles.

查看更多
登录 后发表回答