GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [MSHADE-400] Self-minimisation with custom entry points by kriegaex · Pull Request #110 · apache/maven-shade-plugin

Conversation

@kriegaex

@kriegaex kriegaex commented Jul 22, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • See https://issues.apache.org/jira/browse/MSHADE-400.
  • Solves https://issues.apache.org/jira/browse/MSHADE-366, too.
  • Contains commits from and therefore supersedes
    • [MSHADE-366] - "Access denied" during 'minimizeJar' #83,
    • [MSHADE-366] - "Access denied" during 'minimizeJar' (supersedes #83) #104,
    • basic dir handling in default shader #108 (not all commits, but alternative implementation I already had before the latest commit was pushed).

To do:

  • Add unit test (please help, @rmannibucau, I don't know the API for mocking well enough)
  • Add integration test (I have a simple one in a separate project, which I am going to push)
  • Rebase on master after MSHADE-391 was merged recently (merge conflicts in default shader + test).
  • I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kriegaex
kriegaex force-pushed the MSHADE-400 branch from 7c2ebbd to b91b89a Compare July 22, 2021 06:07
@kriegaex

kriegaex commented Jul 22, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

The merge conflicts during the rebase were pretty ugly, because both in MSHADE-391 as well as here there was refactoring in the default shader. I hope I did not mess up anything. At least, locally the project compiles and some selected key tests for both issues are passing. Let us see what the CI builds say, before I add a specific integration test for self-minimisation.

Update: CI build looks good, both before and after adding my integration test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex

kriegaex commented Jul 22, 2021

Copy link
Copy Markdown
Contributor Author

@JanMosigItemis, would you mind if I squashed your commits (and my early one too)? The original workaround incl. unit test is no longer necessary, nor is my refactoring of it. Only a little bit of structural test refactoring is left over.

@rmannibucau, I can squash your "basic dir handling in default shader" commit too, but also try to retain it, even though Tibor is not going to like it and probably going to squash before the merge anyway. Please also be so kind as to review this PR. I think it is as far as we should go before the next major release, for which you are planning more general refactoring. Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JanMosigItemis

JanMosigItemis commented Jul 22, 2021

Copy link
Copy Markdown
Contributor

Do it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rmannibucau
rmannibucau approved these changes Jul 22, 2021
View reviewed changes
@kriegaex
kriegaex force-pushed the MSHADE-400 branch from 7447201 to fa01e81 Compare July 22, 2021 08:08
@kriegaex

kriegaex commented Jul 22, 2021

Copy link
Copy Markdown
Contributor Author

OK, I squashed into one commit, using Co-authored-by: to set both of you as co-authors. Looks like GitHub understands it, I did it for the first time:

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gnodet gnodet added the enhancement New feature or request label Oct 20, 2022
@kriegaex
kriegaex force-pushed the MSHADE-400 branch from fa01e81 to 1cee035 Compare March 4, 2023 15:28
@kriegaex

kriegaex commented Mar 4, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Rebased on master, as requested by @michael-o. Actually, after 1.5 years of code rot, this was a pain in the neck to rebase with lots of nasty conflicts. I am not even remembering exactly what I did back then and why exactly I did it the way I you see here. It was hard enough to understand the inner workings of this plugin back then, you cannot expect me to remember everything now after such a long time.

As a contributor who does not know the code base well, I would appreciate more timely responses and reviews, because repeatedly rebasing stuff is difficult and error-prone. The tests are still green, but I am not 100% sure if that means the patch is as perfect as it used to be.

michael-o reacted with thumbs up emoji michael-o reacted with laugh emoji
All reactions
  • 👍 1 reaction
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michael-o
michael-o requested changes Mar 4, 2023
View reviewed changes
Comment thread src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented Mar 4, 2023

Copy link
Copy Markdown
Member

Just those two and I will merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex

kriegaex commented Mar 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@michael-o, I pushed my educated guess about what you asked me to do in a separate commit to be more conveniently reviewable. If it looks OK for you and you want me to squash and force-push once more, just let me know.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex @michael-o
[MSHADE-400] Self-minimisation with custom entry points
45dcf07
Also add self-minimisation + SPI services IT.

Remove MinijarFilterTest.removeServicesShouldIgnoreDirectories, because
now removing services precisely does **not** ignore directories anymore.

Co-authored-by: Romain Manni-Bucau <[email protected]>
Co-authored-by: Jan Mosig <[email protected]>

This closes apache#110
@michael-o
michael-o force-pushed the MSHADE-400 branch from 131d4ae to 45dcf07 Compare March 5, 2023 11:03
@asfgit asfgit closed this in 45dcf07 Mar 5, 2023
@asfgit
asfgit merged commit 45dcf07 into apache:master Mar 5, 2023
@kriegaex

kriegaex commented Mar 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Um, sorry @michael-o, what was the rationale behind first asking me for improvements, me consequently doing them and you then not merging them but deciding for the code without the cove review improvements instead? I mean these:

Subject: [PATCH] [MSHADE-400] Code review findings
---
--- a/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java	(revision 1cee035ebcce0376fc1c4e726b18f7a15edb8d76)
+++ b/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java	(revision 131d4ae37eeb25895bdbf54a2b9acb5df2b918c4)
@@ -35,6 +35,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Files;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -228,14 +229,15 @@
             }
 
             try ( final BufferedReader configFileReader = new BufferedReader(
-                    new InputStreamReader( new FileInputStream( serviceProviderConfigFile ), UTF_8 ) ) )
+                    new InputStreamReader( Files.newInputStream( serviceProviderConfigFile.toPath() ), UTF_8 ) ) )
             {
                 // check whether the found classes use services in turn
                 repeatScan |= scanServiceProviderConfigFile( cp, configFileReader );
             }
             catch ( final IOException e )
             {
-                log.warn( e.getMessage() );
+                log.warn( "Failed to scan service provider config file " + serviceProviderConfigFile );
+                log.debug( e );
             }
         }
         return repeatScan;
@@ -269,7 +271,8 @@
                 }
                 catch ( final IOException e )
                 {
-                    log.warn( e.getMessage() );
+                    log.warn( "Failed to scan service provider config file " + jarEntry + " in jar " + jar.getName() );
+                    log.debug( e );
                 }
             }
         }
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java	(revision 1cee035ebcce0376fc1c4e726b18f7a15edb8d76)
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java	(revision 131d4ae37eeb25895bdbf54a2b9acb5df2b918c4)
@@ -996,8 +996,7 @@
             {
                 entryPoints = new HashSet<>();
             }
-            getLog().info( "Minimizing jar " + project.getArtifact()
-                    + ( entryPoints.isEmpty() ? "" : ", entry points = " + entryPoints ) );
+            getLog().info( "Minimizing jar " + project.getArtifact() );
 
             try
             {
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented Mar 16, 2023

Copy link
Copy Markdown
Member

Um, sorry @michael-o, what was the rationale behind first asking me for improvements, me consequently doing them and you then not merging them but deciding for the code without the cove review improvements instead? I mean these:

Subject: [PATCH] [MSHADE-400] Code review findings
---
--- a/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java	(revision 1cee035ebcce0376fc1c4e726b18f7a15edb8d76)
+++ b/src/main/java/org/apache/maven/plugins/shade/filter/MinijarFilter.java	(revision 131d4ae37eeb25895bdbf54a2b9acb5df2b918c4)
@@ -35,6 +35,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Files;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -228,14 +229,15 @@
             }
 
             try ( final BufferedReader configFileReader = new BufferedReader(
-                    new InputStreamReader( new FileInputStream( serviceProviderConfigFile ), UTF_8 ) ) )
+                    new InputStreamReader( Files.newInputStream( serviceProviderConfigFile.toPath() ), UTF_8 ) ) )
             {
                 // check whether the found classes use services in turn
                 repeatScan |= scanServiceProviderConfigFile( cp, configFileReader );
             }
             catch ( final IOException e )
             {
-                log.warn( e.getMessage() );
+                log.warn( "Failed to scan service provider config file " + serviceProviderConfigFile );
+                log.debug( e );
             }
         }
         return repeatScan;
@@ -269,7 +271,8 @@
                 }
                 catch ( final IOException e )
                 {
-                    log.warn( e.getMessage() );
+                    log.warn( "Failed to scan service provider config file " + jarEntry + " in jar " + jar.getName() );
+                    log.debug( e );
                 }
             }
         }
--- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java	(revision 1cee035ebcce0376fc1c4e726b18f7a15edb8d76)
+++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java	(revision 131d4ae37eeb25895bdbf54a2b9acb5df2b918c4)
@@ -996,8 +996,7 @@
             {
                 entryPoints = new HashSet<>();
             }
-            getLog().info( "Minimizing jar " + project.getArtifact()
-                    + ( entryPoints.isEmpty() ? "" : ", entry points = " + entryPoints ) );
+            getLog().info( "Minimizing jar " + project.getArtifact() );
 
             try
             {

It was faster to do it myself at the end than explaning how I expect it to be. For improvement of consistency followup PRs can be created any time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex

kriegaex commented Mar 16, 2023

Copy link
Copy Markdown
Contributor Author

I won't create a new PR after having the work you explicitly asked me to do here already. Too much micro-management. Besides, I did the work before you committed. Why didn't you just commit on top of my PR? Please take my changes and commit them yourself. My branch still exists, you can cherry-pick the commit. Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jira-importer

jira-importer commented Jun 14, 2025

Copy link
Copy Markdown

Resolve #418

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1 similar comment
@jira-importer

jira-importer commented Jun 14, 2025

Copy link
Copy Markdown

Resolve #418

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex

kriegaex commented Sep 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@michael-o I just found this PR again, because it is related to the recently closed #108. A quick check in the current source code reveals that my improvements from #110 (comment), which you had explicitly requested in your code review but then left unmerged, are still missing in the code base. Would you mind committing them? I see no reason why we would both agree on the benefit of a change and then not bring it into the product. Thank you very much.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented Sep 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@michael-o I just found this PR again, because it is related to the recently closed #108. A quick check in the current source code reveals that my improvements from #110 (comment), which you had explicitly requested in your code review but then left unmerged, are still missing in the code base. Would you mind committing them? I see no reason why we would both agree on the benefit of a change and then not bring it into the product. Thank you very much.

I don't exactly remember. If they apply cleanly I'd happily merge them.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kriegaex

kriegaex commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

@michael-o There is no need to remember, I quoted the exact diff above, and you even re-quoted and commented on it. If after this long time the diff would still apply cleanly, I have no idea. But it would not be rocket science to apply those few lines. You had a chance to just merge my PR back then without any hassle. Instead, you created your own commit without the changes you had requested yourself. I am not going to do the same work one more time. I think, the ball is in your court. And please don't say, you are too busy. If your review comment expected those small improvements from me, I hold you to the same standard. Please take a few minutes and finish an unfinished job. Thank you so much.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented Sep 16, 2026

Copy link
Copy Markdown
Member

@michael-o There is no need to remember, I quoted the exact diff above, and you even re-quoted and commented on it. If after this long time the diff would still apply cleanly, I have no idea. But it would not be rocket science to apply those few lines. You had a chance to just merge my PR back then without any hassle. Instead, you created your own commit without the changes you had requested yourself. I am not going to do the same work one more time. I think, the ball is in your court. And please don't say, you are too busy. If your review comment expected those small improvements from me, I hold you to the same standard. Please take a few minutes and finish an unfinished job. Thank you so much.

I have starred this PR and will try to process as soon as I can.

kriegaex reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@michael-o

michael-o commented Sep 20, 2026

Copy link
Copy Markdown
Member

Here it is: #854

Please review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@michael-o michael-o michael-o requested changes
@rmannibucau rmannibucau rmannibucau approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@kriegaex @JanMosigItemis @michael-o @jira-importer @rmannibucau @gnodet @asfgit
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.