You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/09/16 17:16:46 UTC
[GitHub] [maven] gastaldi opened a new pull request #543: [MNG-7253] Display relocation message defined in model
gastaldi opened a new pull request #543:
URL: https://github.com/apache/maven/pull/543
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/MNG) 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.
- [X] Each commit in the pull request should have a meaningful subject line and body.
- [X] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
where you replace `MNG-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.
- [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [X] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will
be performed on your pull request automatically.
- [X] You have run the [Core IT][core-its] successfully.
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 licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [X] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
[core-its]: https://maven.apache.org/core-its/core-it-suite/
--
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
[GitHub] [maven] gastaldi commented on pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
gastaldi commented on pull request #543:
URL: https://github.com/apache/maven/pull/543#issuecomment-922281308
> @rfscholte I think this is not good enough and in the right place.
**not** or **now**? 😄
--
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
[GitHub] [maven] michael-o commented on pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #543:
URL: https://github.com/apache/maven/pull/543#issuecomment-922281780
**now**
--
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
[GitHub] [maven] michael-o edited a comment on pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o edited a comment on pull request #543:
URL: https://github.com/apache/maven/pull/543#issuecomment-922280934
@rfscholte I think this is now good enough and in the right place.
--
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
[GitHub] [maven] michael-o commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r711234574
##########
File path: maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
##########
@@ -319,10 +323,20 @@ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorReques
if ( relocation != null )
{
result.addRelocation( a );
- a =
+ Artifact relocatedArtifact =
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
relocation.getVersion() );
- result.setArtifact( a );
+ if ( LOGGER.isWarnEnabled() )
+ {
+ String message = "The artifact " + a + " has been relocated to " + relocatedArtifact;
+ if ( relocation.getMessage() != null )
+ {
+ message += ": " + relocation.getMessage();
+ }
+ LOGGER.warn( message );
+ }
+ result.setArtifact( relocatedArtifact );
+ a = relocatedArtifact;
Review comment:
I know, but why is redefining this variable which isn't used in the loop anymore fixes the issue?
--
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
[GitHub] [maven] asfgit closed pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #543:
URL: https://github.com/apache/maven/pull/543
--
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
[GitHub] [maven] michael-o commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r711230552
##########
File path: maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
##########
@@ -319,10 +323,20 @@ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorReques
if ( relocation != null )
{
result.addRelocation( a );
- a =
+ Artifact relocatedArtifact =
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
relocation.getVersion() );
- result.setArtifact( a );
+ if ( LOGGER.isWarnEnabled() )
+ {
+ String message = "The artifact " + a + " has been relocated to " + relocatedArtifact;
+ if ( relocation.getMessage() != null )
+ {
+ message += ": " + relocation.getMessage();
+ }
+ LOGGER.warn( message );
+ }
+ result.setArtifact( relocatedArtifact );
+ a = relocatedArtifact;
Review comment:
I wonder why this line is necessary....
--
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
[GitHub] [maven] gastaldi commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
gastaldi commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r710432899
##########
File path: maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
##########
@@ -190,8 +191,20 @@ public DependencyResolutionResult resolve( DependencyResolutionRequest request )
{
if ( !child.getRelocations().isEmpty() )
{
- logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
- + child.getDependency().getArtifact() );
+ org.eclipse.aether.artifact.Artifact artifact = child.getRelocations().get( 0 );
+ StringBuilder message = new StringBuilder();
+ message.append( "The artifact " ).append( artifact )
Review comment:
Your statement is true, however there are two `if`s in the code that would create another `StringBuilder` and I wanted to avoid that
--
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
[GitHub] [maven] michael-o commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r710429384
##########
File path: maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
##########
@@ -190,8 +191,20 @@ public DependencyResolutionResult resolve( DependencyResolutionRequest request )
{
if ( !child.getRelocations().isEmpty() )
{
- logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
- + child.getDependency().getArtifact() );
+ org.eclipse.aether.artifact.Artifact artifact = child.getRelocations().get( 0 );
+ StringBuilder message = new StringBuilder();
+ message.append( "The artifact " ).append( artifact )
Review comment:
The StringBuilder is redudant because constant string concat will be turned into a StringBuilder internally anyway. SBs are useful for loops 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
[GitHub] [maven] gastaldi commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
gastaldi commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r711235714
##########
File path: maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
##########
@@ -319,10 +323,20 @@ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorReques
if ( relocation != null )
{
result.addRelocation( a );
- a =
+ Artifact relocatedArtifact =
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
relocation.getVersion() );
- result.setArtifact( a );
+ if ( LOGGER.isWarnEnabled() )
+ {
+ String message = "The artifact " + a + " has been relocated to " + relocatedArtifact;
+ if ( relocation.getMessage() != null )
+ {
+ message += ": " + relocation.getMessage();
+ }
+ LOGGER.warn( message );
+ }
+ result.setArtifact( relocatedArtifact );
+ a = relocatedArtifact;
Review comment:
I had to read twice to understand that the loop is initialized only once and this variable is used again in the next iteration :)
--
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
[GitHub] [maven] michael-o commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r711236179
##########
File path: maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
##########
@@ -319,10 +323,20 @@ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorReques
if ( relocation != null )
{
result.addRelocation( a );
- a =
+ Artifact relocatedArtifact =
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
relocation.getVersion() );
- result.setArtifact( a );
+ if ( LOGGER.isWarnEnabled() )
+ {
+ String message = "The artifact " + a + " has been relocated to " + relocatedArtifact;
+ if ( relocation.getMessage() != null )
+ {
+ message += ": " + relocation.getMessage();
+ }
+ LOGGER.warn( message );
+ }
+ result.setArtifact( relocatedArtifact );
+ a = relocatedArtifact;
Review comment:
Alright, then this makes sense otherwise it'd be moot.
--
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
[GitHub] [maven] michael-o commented on pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #543:
URL: https://github.com/apache/maven/pull/543#issuecomment-922280934
@rfscholte I think this is not good enough and in the right place.
--
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
[GitHub] [maven] gastaldi commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
gastaldi commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r711232865
##########
File path: maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
##########
@@ -319,10 +323,20 @@ private Model loadPom( RepositorySystemSession session, ArtifactDescriptorReques
if ( relocation != null )
{
result.addRelocation( a );
- a =
+ Artifact relocatedArtifact =
new RelocatedArtifact( a, relocation.getGroupId(), relocation.getArtifactId(),
relocation.getVersion() );
- result.setArtifact( a );
+ if ( LOGGER.isWarnEnabled() )
+ {
+ String message = "The artifact " + a + " has been relocated to " + relocatedArtifact;
+ if ( relocation.getMessage() != null )
+ {
+ message += ": " + relocation.getMessage();
+ }
+ LOGGER.warn( message );
+ }
+ result.setArtifact( relocatedArtifact );
+ a = relocatedArtifact;
Review comment:
That's the fix for the bug I found previously
--
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
[GitHub] [maven] gastaldi commented on a change in pull request #543: [MNG-7253] Display relocation message defined in model
Posted by GitBox <gi...@apache.org>.
gastaldi commented on a change in pull request #543:
URL: https://github.com/apache/maven/pull/543#discussion_r710439035
##########
File path: maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
##########
@@ -190,8 +191,20 @@ public DependencyResolutionResult resolve( DependencyResolutionRequest request )
{
if ( !child.getRelocations().isEmpty() )
{
- logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
- + child.getDependency().getArtifact() );
+ org.eclipse.aether.artifact.Artifact artifact = child.getRelocations().get( 0 );
+ StringBuilder message = new StringBuilder();
+ message.append( "The artifact " ).append( artifact )
Review comment:
Anyway, I changed that to String if that's an issue
--
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