[MNG-8588] Add activated profiles to Project interface#2132
[MNG-8588] Add activated profiles to Project interface#2132gnodet merged 6 commits intoapache:masterfrom
Conversation
|
@Giovds I went ahead and added the |
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I'm trying to think of a different name for the getAll(Active)Profiles() methods, as it might be interpreted the same as getProfiles(). I was thinking something alone the lines of getAll(Active)ProfilesIncludingInherited(), or rename get(Active)Profiles() to something like getCurrent(Active)Profiles()
There was a problem hiding this comment.
What about:
getDeclaredProfiles()/getEffectiveProfiles()getDeclaredActiveProfiles()/getEffectiveActiveProfiles()
The declared would make reference to only profiles on the current project, while effective would make reference to profiles from the project and it's hierarchy, similar to the effective model which is computed with the parents merged into it.
There was a problem hiding this comment.
Thats a good one. As it also follows the terminology we use within other parts of the code base and documentation. It does require some knowledge of our domain as consumer of the API but the docs clearly describe the intent
There was a problem hiding this comment.
You could make the methods a one liner, if you'd like with something like this I think:
return Stream.iterate(this.project, Objects::nonNull, MavenProject::getParent)
.flatMap(project -> project.getActiveProfiles().stream())
.map(org.apache.maven.model.Profile::getDelegate)
.toList();…efaultProject.java Co-authored-by: Giovanni van der Schelde <27761321+Giovds@users.noreply.github.com>
|
Resolve #9367 |
Based on #2119