Skip to content

[MNG-8075] Deprecate project.baseUri in favor of project.basedir.uri #2184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions compat/maven-model-builder/src/site/apt/index.apt
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ Maven Model Builder
<<<pom.basedir>>> (<deprecated>)\
<<<basedir>>> (<deprecated>) | the directory containing the <<<pom.xml>>> file | <<<$\{project.basedir\}>>> |
*----+------+------+
| <<<project.baseUri>>>\
<<<pom.baseUri>>> (<deprecated>) | the directory containing the <<<pom.xml>>> file as URI | <<<$\{project.baseUri\}>>> |
| <<<project.baseUri>>> (<deprecated>)\
<<<pom.baseUri>>> (<deprecated>) | the directory containing the <<<pom.xml>>> file as URI. Those properties are deprecated, use <<<$\{project.basedir.uri\}>>> instead. | <<<$\{project.basedir.uri\}>>> |
*----+------+------+
| <<<project.rootDirectory>>> | the project's root directory (containing a <<<.mvn>>> directory or with the <<<root="true">>> xml attribute) | <<<$\{project.rootDirectory\}>>> |
*----+------+------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,16 @@ private void validateRawRepositories(
Matcher m = EXPRESSION_NAME_PATTERN.matcher(repository.getUrl());
while (m.find()) {
String expr = m.group(1);
if (!("basedir".equals(expr)
if ("project.baseUri".equals(expr)) {
addViolation(
problems,
Severity.WARNING,
Version.V40,
prefix + prefix2 + "[" + repository.getId() + "].url",
null,
"contains a deprecated 'project.baseUri' expression, use 'project.basedir.uri' instead.",
repository);
} else if (!("basedir".equals(expr)
|| "project.basedir".equals(expr)
|| expr.startsWith("project.basedir.")
|| "project.rootDirectory".equals(expr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ void repositoryWithExpression() throws Exception {

@Test
void repositoryWithBasedirExpression() throws Exception {
SimpleProblemCollector result = validateRaw("raw-model/repository-with-basedir-expression.xml");
assertViolations(result, 0, 0, 0);
SimpleProblemCollector result = validateFile("raw-model/repository-with-basedir-expression.xml");
assertViolations(result, 0, 0, 1);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ under the License.
<id>repo</id>
<url>file://${x}/sdk/maven/repo</url>
</repository>
<repository>
<id>repo2</id>
<url>${project.basedir.uri}/sdk/maven/repo</url>
</repository>
</repositories>

</project>