You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "abelsromero (via GitHub)" <gi...@apache.org> on 2024/01/13 12:57:58 UTC
[PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
abelsromero opened a new pull request, #93:
URL: https://github.com/apache/maven-filtering/pull/93
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MSHARED) filed
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
:point_right: https://issues.apache.org/jira/browse/MSHARED-1351?jql=component%20%3D%20maven-filtering%20
- [x] Each commit in the pull request should have a meaningful subject line and body.
:crossed_fingers:
- [x] Format the pull request title like `[MSHARED-XXX] - Fixes bug in ApproximateQuantiles`,
where you replace `MSHARED-XXX` with the appropriate JIRA issue. Best practice
is to use the JIRA issue title in the pull request title and in the first line of the
commit message.
:point_right: `[MSHARED-1351] - Fix console message when origin is baseDir`
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
Checks when the path for the message is empty, then replaces that empty with "base dir" to avoid an invalid message.
I considered directly comparing paths
```java
String origin;
if (basedir.equals(resourceDirectory)) {
origin = "base directory";
} else {
origin = basedir.relativize( resourceDirectory.getAbsoluteFile().toPath()) .toString();
}
```
It's more expressive, but that adds extra path processing that are not necessary if we simply check the relativized result.
PS: run
- [x] Run `mvn clean verify -Prun-its` to make sure basic checks pass. A more thorough check will
be performed on your pull request automatically.
:ok: The profile does not exist btw, simply run `mvn clean verify` and `mvn spotless:apply` to fix formatting.
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1452231849
##########
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java:
##########
@@ -254,9 +255,15 @@ private File getTargetFile(File file) throws MavenFilteringException {
Path destination = getDestinationFile(outputDirectory, targetPath, "", mavenResourcesExecution)
.getAbsoluteFile()
.toPath();
+ String origin = basedir.relativize(
+ resourceDirectory.getAbsoluteFile().toPath())
+ .toString();
+ if (StringUtils.isEmpty(origin)) {
+ origin = "base directory";
Review Comment:
classical value is `.`, isn't it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1963010320
> recently I've fixed similar code here [codehaus-plexus/plexus-compiler#364](https://github.com/codehaus-plexus/plexus-compiler/issues/364)
Not sure is the same thing. I don't have context on the other project, but the issue is that `relativize` will return an empty string in some cases, not an exception. Seems to me that the issue could still happen in `plexus-compiler` .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1919621316
Fixed the formatting, is there a way to run the pipeline without manual intervention?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1919531112
Anything else I should be checking? I don't any have anything identified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #93:
URL: https://github.com/apache/maven-filtering/pull/93
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1890456578
Sent signed the CLA to the required address.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1454775248
##########
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java:
##########
@@ -254,9 +255,15 @@ private File getTargetFile(File file) throws MavenFilteringException {
Path destination = getDestinationFile(outputDirectory, targetPath, "", mavenResourcesExecution)
.getAbsoluteFile()
.toPath();
+ String origin = basedir.relativize(
+ resourceDirectory.getAbsoluteFile().toPath())
+ .toString();
+ if (StringUtils.isEmpty(origin)) {
+ origin = "base directory";
Review Comment:
yes, `.` technically valid value instead of `base directory` human readable-only
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1452265164
##########
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java:
##########
@@ -254,9 +255,15 @@ private File getTargetFile(File file) throws MavenFilteringException {
Path destination = getDestinationFile(outputDirectory, targetPath, "", mavenResourcesExecution)
.getAbsoluteFile()
.toPath();
+ String origin = basedir.relativize(
+ resourceDirectory.getAbsoluteFile().toPath())
+ .toString();
+ if (StringUtils.isEmpty(origin)) {
+ origin = "base directory";
Review Comment:
Are you suggesting to put "." in the message?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1456564669
##########
src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java:
##########
@@ -24,13 +24,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
Review Comment:
Got it finally installing palantir Intellij plugin and configuring imports

Spotless does not detect the imports with wildcards, seems something could be done in that regard https://github.com/diffplug/spotless/issues/649#issuecomment-738199681
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1945593859
Hi, all seems green in CI, except for 1 job that was mysteriously canceled. 🤷 Is there anything else that needs my attention in the PR? Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1454778432
##########
src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java:
##########
@@ -24,13 +24,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
Review Comment:
please don't reformat this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1456564669
##########
src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java:
##########
@@ -24,13 +24,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
Review Comment:
Got it finally installing palantir Intellij plugin and configuring imports (leaving here for anyone else)

Spotless does not detect the imports with wildcards, seems something could be done in that regard https://github.com/diffplug/spotless/issues/649#issuecomment-738199681
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1902064303
Run a customized pipeline on a fork and now Windows passes https://github.com/abelsromero/maven-filtering/actions/runs/7590061551
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1962732968
recently I've fixed similar code here https://github.com/codehaus-plexus/plexus-compiler/issues/364
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1452232812
##########
src/main/java/org/apache/maven/shared/filtering/ConsoleHolder.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * http://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 org.apache.maven.shared.filtering;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+/**
+ * Helping class to capture console input and output for tests.
+ *
+ * @author abelsromero
+ * @since 3.3.2
+ */
+class ConsoleHolder {
Review Comment:
better in `src/test/java` than `src/main/java`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1454936658
##########
src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java:
##########
@@ -24,13 +24,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
Review Comment:
I had issues configuring the formatting and handled that by hand, I'll give it another try and review all files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1456561815
##########
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java:
##########
@@ -254,9 +255,15 @@ private File getTargetFile(File file) throws MavenFilteringException {
Path destination = getDestinationFile(outputDirectory, targetPath, "", mavenResourcesExecution)
.getAbsoluteFile()
.toPath();
+ String origin = basedir.relativize(
+ resourceDirectory.getAbsoluteFile().toPath())
+ .toString();
+ if (StringUtils.isEmpty(origin)) {
+ origin = "base directory";
Review Comment:
Done, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on code in PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#discussion_r1454775248
##########
src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java:
##########
@@ -254,9 +255,15 @@ private File getTargetFile(File file) throws MavenFilteringException {
Path destination = getDestinationFile(outputDirectory, targetPath, "", mavenResourcesExecution)
.getAbsoluteFile()
.toPath();
+ String origin = basedir.relativize(
+ resourceDirectory.getAbsoluteFile().toPath())
+ .toString();
+ if (StringUtils.isEmpty(origin)) {
+ origin = "base directory";
Review Comment:
yes, `.` instead of `base directory`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MSHARED-1351] Fix console message when origin is baseDir [maven-filtering]
Posted by "abelsromero (via GitHub)" <gi...@apache.org>.
abelsromero commented on PR #93:
URL: https://github.com/apache/maven-filtering/pull/93#issuecomment-1899956077
I see Windows failures for path format, I'll see to it later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org