-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add overrides for url, scm, licenses and developers to POM
This behavior is controlled via the addOverrideIfEmpty flag on the MavenBuildSettings. It defaults to false, but is switched to true in the DefaultMavenBuildCustomizer. Closes gh-1242
- Loading branch information
1 parent
f41b879
commit 0c7882e
Showing
24 changed files
with
389 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...spring/initializr/generator/spring/build/maven/ParentOverridesHelpDocumentCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2012-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.spring.initializr.generator.spring.build.maven; | ||
|
||
import java.util.Collections; | ||
|
||
import io.spring.initializr.generator.buildsystem.maven.MavenBuildSettings; | ||
import io.spring.initializr.generator.spring.documentation.HelpDocument; | ||
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer; | ||
|
||
/** | ||
* {@link HelpDocumentCustomizer} to add a section about the parent overrides in place. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class ParentOverridesHelpDocumentCustomizer implements HelpDocumentCustomizer { | ||
|
||
private final MavenBuildSettings buildSettings; | ||
|
||
ParentOverridesHelpDocumentCustomizer(MavenBuildSettings buildSettings) { | ||
this.buildSettings = buildSettings; | ||
} | ||
|
||
@Override | ||
public void customize(HelpDocument document) { | ||
if (this.buildSettings.isAddOverrideIfEmpty()) { | ||
document.addSection("documentation/parent-overrides", Collections.emptyMap()); | ||
} | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...izr-generator-spring/src/main/resources/templates/documentation/parent-overrides.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
### Maven Parent overrides | ||
|
||
Due to Maven's design, elements are inherited from the parent POM to the project POM. | ||
While most of the inheritance is fine, it also inherits unwanted elements like `<license>` and `<developers>` from the parent. | ||
To prevent this, the project POM contains empty overrides for these elements. | ||
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.