Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions util/maven/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Profile struct {
ID String `xml:"id,omitempty"`
Activation Activation `xml:"activation,omitempty"`
Properties Properties `xml:"properties,omitempty"`
Modules []String `xml:"modules>module,omitempty"`
DependencyManagement DependencyManagement `xml:"dependencyManagement,omitempty"`
Dependencies []Dependency `xml:"dependencies>dependency,omitempty"`
Repositories []Repository `xml:"repositories>repository,omitempty"`
Expand Down Expand Up @@ -201,6 +202,7 @@ func (p *Project) MergeProfiles(jdk string, os ActivationOS) (err error) {
p.DependencyManagement.merge(prof.DependencyManagement)
p.Dependencies = append(p.Dependencies, prof.Dependencies...)
p.Repositories = append(p.Repositories, prof.Repositories...)
p.Modules = append(p.Modules, prof.Modules...)
}
return
}
Expand Down
9 changes: 9 additions & 0 deletions util/maven/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func TestProfile(t *testing.T) {
ArtifactID: "def",
Version: "${def.version}",
}},
Modules: []String{
"module-a",
"module-b",
},
}, {
ID: "my-profile-2",
Activation: Activation{
Expand Down Expand Up @@ -362,6 +366,7 @@ func TestMergeProfiles(t *testing.T) {
{Name: "abc.version", Value: "1.0.0"},
},
},
Modules: []String{"default-module"},
Profiles: []Profile{{
// Not activated
Activation: Activation{
Expand All @@ -378,6 +383,7 @@ func TestMergeProfiles(t *testing.T) {
{Name: "abc.version", Value: "9.9.9"},
},
},
Modules: []String{"module-not-activated"},
}, {
// Activated
Activation: Activation{
Expand All @@ -395,6 +401,7 @@ func TestMergeProfiles(t *testing.T) {
{Name: "abc.version", Value: "2.0.0"},
},
},
Modules: []String{"module-activated-1", "module-activated-2"},
}, {
// Activated
Activation: Activation{
Expand All @@ -419,6 +426,7 @@ func TestMergeProfiles(t *testing.T) {
{Name: "abc.version", Value: "3.0.0"},
},
},
Modules: []String{"module-activated-3"},
}},
}
proj.MergeProfiles(JDKProfileActivation, OSProfileActivation)
Expand Down Expand Up @@ -447,6 +455,7 @@ func TestMergeProfiles(t *testing.T) {
{Name: "abc.version", Value: "3.0.0"},
},
},
Modules: []String{"default-module", "module-activated-1", "module-activated-2", "module-activated-3"},
}
proj.Profiles = nil
if diff := cmp.Diff(proj, want); diff != "" {
Expand Down
4 changes: 4 additions & 0 deletions util/maven/testdata/profiles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<version>${def.version}</version>
</dependency>
</dependencies>
<modules>
<module>module-a</module>
<module>module-b</module>
</modules>
</profile>
<profile>
<id>my-profile-2</id>
Expand Down
Loading