Add support for configuring a Maven parent relative path

Closes gh-1296
This commit is contained in:
Stephane Nicoll
2022-01-22 11:20:06 +01:00
parent 5a4e7fac95
commit a961c52450
9 changed files with 99 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -542,7 +542,7 @@ public class InitializrConfiguration {
*/
public ParentPom resolveParentPom(String bootVersion) {
return (StringUtils.hasText(this.parent.groupId) ? this.parent
: new ParentPom(DEFAULT_PARENT_GROUP_ID, DEFAULT_PARENT_ARTIFACT_ID, bootVersion));
: new ParentPom(DEFAULT_PARENT_GROUP_ID, DEFAULT_PARENT_ARTIFACT_ID, bootVersion, ""));
}
/**
@@ -577,15 +577,21 @@ public class InitializrConfiguration {
*/
private String version;
/**
* Parent relative path.
*/
private String relativePath = "";
/**
* Add the "spring-boot-dependencies" BOM to the project.
*/
private boolean includeSpringBootBom;
public ParentPom(String groupId, String artifactId, String version) {
public ParentPom(String groupId, String artifactId, String version, String relativePath) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.relativePath = relativePath;
}
public ParentPom() {
@@ -615,6 +621,14 @@ public class InitializrConfiguration {
this.version = version;
}
public String getRelativePath() {
return this.relativePath;
}
public void setRelativePath(String relativePath) {
this.relativePath = relativePath;
}
public boolean isIncludeSpringBootBom() {
return this.includeSpringBootBom;
}