Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package maven-shade-plugin for openSUSE:Factory checked in at 2025-09-16 18:18:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/maven-shade-plugin (Old) and /work/SRC/openSUSE:Factory/.maven-shade-plugin.new.1977 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "maven-shade-plugin" Tue Sep 16 18:18:17 2025 rev:5 rq:1305023 version:3.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/maven-shade-plugin/maven-shade-plugin.changes 2024-11-26 20:57:20.414026272 +0100 +++ /work/SRC/openSUSE:Factory/.maven-shade-plugin.new.1977/maven-shade-plugin.changes 2025-09-16 18:18:25.175147823 +0200 @@ -1,0 +2,24 @@ +Mon Sep 15 18:27:51 UTC 2025 - Fridrich Strba <[email protected]> + +- Upgrade to upstream version 3.6.1 + * Documentation updates + + MNGSITE-529: Rename "Goals" to "Plugin Documentation" + * Maintenance + + Enable prevent branch protection rules + + Enable GH issues + + Add missing @OverRide annotations + + Merge ApacheLicenseResourceTransformer tests + + Add test cases for .md supports in the Apache License and + Notice transformers + + MSHADE-479: Make the mojo much less noisy + * Dependency updates + + Bump org.codehaus.mojo:mrm-maven-plugin from 1.6.0 to 1.7.0 + + Bump org.hamcrest:hamcrest-core from 2.2 to 3.0 + + Bump org.apache.maven.plugins:maven-plugins from 42 to 45 + + Bump org.apache.commons:commons-compress from 1.26.2 to 1.28.0 + + Bump org.xmlunit:xmlunit-legacy from 2.10.0 to 2.10.3 + + Bump ASM 9.8 to support JDK 25 bytecode + + Bump commons-io:commons-io from 2.13.0 to 2.14.0 in + /src/it/projects/MSHADE-105/shaded-jar + +------------------------------------------------------------------- Old: ---- maven-shade-plugin-3.6.0-source-release.zip New: ---- _scmsync.obsinfo build.specials.obscpio maven-shade-plugin-3.6.1-source-release.zip ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ maven-shade-plugin.spec ++++++ --- /var/tmp/diff_new_pack.chtAtf/_old 2025-09-16 18:18:25.607166020 +0200 +++ /var/tmp/diff_new_pack.chtAtf/_new 2025-09-16 18:18:25.607166020 +0200 @@ -17,7 +17,7 @@ Name: maven-shade-plugin -Version: 3.6.0 +Version: 3.6.1 Release: 0 Summary: Capability to package the artifact in an uber-jar License: Apache-2.0 ++++++ _scmsync.obsinfo ++++++ mtime: 1757961377 commit: 36bd5fe9effdd59433b595eefe0202da5bd9db2954bac4bc8c57b3146eb28d40 url: https://src.opensuse.org/java-packages/maven-shade-plugin.git revision: 36bd5fe9effdd59433b595eefe0202da5bd9db2954bac4bc8c57b3146eb28d40 projectscmsync: https://src.opensuse.org/java-packages/_ObsPrj ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2025-09-15 20:36:42.000000000 +0200 @@ -0,0 +1 @@ +.osc ++++++ maven-shade-plugin-3.6.0-source-release.zip -> maven-shade-plugin-3.6.1-source-release.zip ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/DEPENDENCIES new/maven-shade-plugin-3.6.1/DEPENDENCIES --- old/maven-shade-plugin-3.6.0/DEPENDENCIES 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/DEPENDENCIES 2025-09-10 00:53:28.000000000 +0200 @@ -26,13 +26,13 @@ From: 'OW2' (http://www.ow2.org/) - - asm (http://asm.ow2.io/) org.ow2.asm:asm:jar:9.7 + - asm (http://asm.ow2.io/) org.ow2.asm:asm:jar:9.8 License: BSD-3-Clause (https://asm.ow2.io/license.html) - - asm-commons (http://asm.ow2.io/) org.ow2.asm:asm-commons:jar:9.7 + - asm-commons (http://asm.ow2.io/) org.ow2.asm:asm-commons:jar:9.8 License: BSD-3-Clause (https://asm.ow2.io/license.html) - - asm-tree (http://asm.ow2.io/) org.ow2.asm:asm-tree:jar:9.7 + - asm-tree (http://asm.ow2.io/) org.ow2.asm:asm-tree:jar:9.8 License: BSD-3-Clause (https://asm.ow2.io/license.html) @@ -44,13 +44,13 @@ From: 'The Apache Software Foundation' (https://www.apache.org/) - - Apache Commons Codec (https://commons.apache.org/proper/commons-codec/) commons-codec:commons-codec:jar:1.17.0 + - Apache Commons Codec (https://commons.apache.org/proper/commons-codec/) commons-codec:commons-codec:jar:1.19.0 License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) - Apache Commons IO (https://commons.apache.org/proper/commons-io/) commons-io:commons-io:jar:2.16.1 License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) - - Apache Commons Compress (https://commons.apache.org/proper/commons-compress/) org.apache.commons:commons-compress:jar:1.26.2 + - Apache Commons Compress (https://commons.apache.org/proper/commons-compress/) org.apache.commons:commons-compress:jar:1.28.0 License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) - Apache Commons Lang (https://commons.apache.org/proper/commons-lang/) org.apache.commons:commons-lang3:jar:3.14.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/NOTICE new/maven-shade-plugin-3.6.1/NOTICE --- old/maven-shade-plugin-3.6.0/NOTICE 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/NOTICE 2025-09-10 00:53:28.000000000 +0200 @@ -1,5 +1,5 @@ Apache Maven Shade Plugin -Copyright 2002-2024 The Apache Software Foundation +Copyright 2002-2025 The Apache Software Foundation This product includes software developed at diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/README.md new/maven-shade-plugin-3.6.1/README.md --- old/maven-shade-plugin-3.6.0/README.md 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/README.md 2025-09-10 00:53:28.000000000 +0200 @@ -17,15 +17,14 @@ Contributing to [Apache Maven Shade Plugin](https://maven.apache.org/plugins/maven-shade-plugin/) ====================== -[][jira] [][license] [](https://search.maven.org/artifact/org.apache.maven.plugins/maven-shade-plugin) -[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-shade-plugin/README.md) +[](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-shade-plugin/README.md) [][build] [][test-results] -You have found a bug or you have an idea for a cool new feature? Contributing +You have found a bug, or you have an idea for a cool new feature? Contributing code is a great way to give something back to the open source community. Before you dig right into the code, there are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of @@ -34,7 +33,6 @@ Getting Started --------------- -+ Make sure you have a [JIRA account](https://issues.apache.org/jira/). + Make sure you have a [GitHub account](https://github.com/signup/free). + If you're planning to implement a new feature, it makes sense to discuss your changes on the [dev list][ml-list] first. @@ -60,29 +58,16 @@ + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted, create a separate PR for this change. + Check for unnecessary whitespace with `git diff --check` before committing. -+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. -``` -[MSHADE-XXX] - Subject of the JIRA Ticket - Optional supplemental description. -``` + Make sure you have added the necessary tests (JUnit/IT) for your changes. + Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. + Submit a pull request to the repository in the Apache organization. -+ Update your JIRA ticket and include a link to the pull request in the ticket. If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. -Making Trivial Changes ----------------------- - -For changes of a trivial nature to comments and documentation, it is not always -necessary to create a new ticket in JIRA. In this case, it is appropriate to -start the first line of a commit with '(doc)' instead of a ticket number. - Developer Tips -------------- -If your machine is sufficiently powerful and you want to parallelise the IT execution to validate the build +If your machine is sufficiently powerful, and you want to parallelize the IT execution to validate the build before a PR you can set the concurrency in `MAVEN_OPTS`: ```` @@ -99,14 +84,15 @@ -------------------- + [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) -+ [Apache Maven Shade JIRA project page][jira] + [Contributor License Agreement][cla] + [General GitHub documentation](https://help.github.com/) + [GitHub pull request documentation](https://help.github.com/send-pull-requests/) -+ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ [Apache Maven X Account](https://x.com/ASFMavenProject) ++ [Apache Maven Bluesky Account](https://bsky.app/profile/maven.apache.org) ++ [Apache Maven Mastodon Account](https://mastodon.social/deck/@[email protected]) + [Slack channel for regular contributors](https://infra.apache.org/slack.html) -[jira]: https://issues.apache.org/jira/projects/MSHADE/ + [license]: https://www.apache.org/licenses/LICENSE-2.0 [ml-list]: https://maven.apache.org/mailing-lists.html [code-style]: https://maven.apache.org/developers/conventions/code.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/pom.xml new/maven-shade-plugin-3.6.1/pom.xml --- old/maven-shade-plugin-3.6.0/pom.xml 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/pom.xml 2025-09-10 00:53:28.000000000 +0200 @@ -23,12 +23,12 @@ <parent> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugins</artifactId> - <version>42</version> + <version>45</version> <relativePath /> </parent> <artifactId>maven-shade-plugin</artifactId> - <version>3.6.0</version> + <version>3.6.1</version> <packaging>maven-plugin</packaging> <name>Apache Maven Shade Plugin</name> @@ -58,14 +58,14 @@ </prerequisites> <scm> - <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-shade-plugin.git</connection> - <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-shade-plugin.git</developerConnection> - <tag>maven-shade-plugin-3.6.0</tag> + <connection>scm:git:https://github.com/apache/maven-shade-plugin.git</connection> + <developerConnection>scm:git:https://github.com/apache/maven-shade-plugin.git</developerConnection> + <tag>maven-shade-plugin-3.6.1</tag> <url>https://github.com/apache/maven-shade-plugin/tree/${project.scm.tag}</url> </scm> <issueManagement> - <system>jira</system> - <url>https://issues.apache.org/jira/browse/MSHADE</url> + <system>GitHub</system> + <url>https://github.com/apache/maven-shade-plugin/issues/</url> </issueManagement> <ciManagement> <system>Jenkins</system> @@ -82,9 +82,9 @@ <mavenVersion>3.9.7</mavenVersion> <javaVersion>8</javaVersion> <currentVersion>${project.version}</currentVersion> - <asmVersion>9.7</asmVersion> + <asmVersion>9.8</asmVersion> <slf4j.version>1.7.36</slf4j.version> - <project.build.outputTimestamp>2024-05-28T15:15:36Z</project.build.outputTimestamp> + <project.build.outputTimestamp>2025-09-10T00:53:27Z</project.build.outputTimestamp> </properties> <dependencies> @@ -116,6 +116,7 @@ <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> + <version>3.15.1</version> <scope>provided</scope> </dependency> @@ -159,7 +160,7 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> - <version>1.26.2</version> + <version>1.28.0</version> </dependency> <dependency> <groupId>commons-io</groupId> @@ -194,13 +195,13 @@ <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> - <version>2.2</version> + <version>3.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-legacy</artifactId> - <version>2.10.0</version> + <version>2.10.3</version> <scope>test</scope> </dependency> <dependency> @@ -317,7 +318,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>mrm-maven-plugin</artifactId> - <version>1.6.0</version> + <version>1.7.0</version> <configuration> <repositories> <mockRepo> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/it/projects/MSHADE-105/shaded-jar/pom.xml new/maven-shade-plugin-3.6.1/src/it/projects/MSHADE-105/shaded-jar/pom.xml --- old/maven-shade-plugin-3.6.0/src/it/projects/MSHADE-105/shaded-jar/pom.xml 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/it/projects/MSHADE-105/shaded-jar/pom.xml 2025-09-10 00:53:28.000000000 +0200 @@ -30,7 +30,7 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.13.0</version> + <version>2.14.0</version> </dependency> </dependencies> <build> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java 2025-09-10 00:53:28.000000000 +0200 @@ -256,6 +256,7 @@ } } + @SuppressWarnings("checkstyle:ParameterNumber") private void shadeDir( ShadeRequest shadeRequest, Set<String> resources, @@ -320,6 +321,7 @@ } } + @SuppressWarnings("checkstyle:ParameterNumber") private void shadeJar( ShadeRequest shadeRequest, Set<String> resources, @@ -381,6 +383,7 @@ return false; } + @SuppressWarnings("checkstyle:ParameterNumber") private void shadeJarEntry( ShadeRequest shadeRequest, Set<String> resources, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java 2025-09-10 00:53:28.000000000 +0200 @@ -80,11 +80,13 @@ } /** {@inheritDoc} */ + @Override public boolean canFilter(File jar) { return jars.contains(jar); } /** {@inheritDoc} */ + @Override public boolean isFiltered(String classFile) { String path = normalizePath(classFile); @@ -155,5 +157,6 @@ } /** {@inheritDoc} */ + @Override public void finished() {} } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java 2025-09-10 00:53:28.000000000 +0200 @@ -316,8 +316,8 @@ * When true, dependencies will be stripped down on the class level to only the transitive hull required for the * artifact. See also {@link #entryPoints}, if you wish to further optimize JAR minimization. * <p> - * <em>Note:</em> This feature requires Java 1.8 or higher due to its use of - * <a href="https://github.com/tcurdt/jdependency">jdependency</a>. Its accuracy therefore also depends on + * <em>Note:</em> This feature uses + * <a href="https://github.com/tcurdt/jdependency">jdependency</a>. Its accuracy therefore depends on * jdependency's limitations. * * @since 1.4 @@ -447,6 +447,7 @@ /** * @throws MojoExecutionException in case of an error. */ + @SuppressWarnings("checkstyle:methodlength") @Override public void execute() throws MojoExecutionException { if (skip) { @@ -766,7 +767,7 @@ continue; } - getLog().info("Including " + artifact.getId() + " in the shaded jar."); + getLog().debug("Including " + artifact.getId() + " in the shaded jar."); artifacts.add(artifact.getFile()); artifactIds.add(getId(artifact)); @@ -804,10 +805,10 @@ } for (String artifactId : excludedArtifacts) { - getLog().info("Excluding " + artifactId + " from the shaded jar."); + getLog().debug("Excluding " + artifactId + " from the shaded jar."); } for (String artifactId : pomArtifacts) { - getLog().info("Skipping pom dependency " + artifactId + " in the shaded jar."); + getLog().debug("Skipping pom dependency " + artifactId + " in the shaded jar."); } for (String artifactId : emptySourceArtifacts) { getLog().warn("Skipping empty source jar " + artifactId + "."); @@ -826,7 +827,7 @@ } private void replaceFile(File oldFile, File newFile) throws MojoExecutionException { - getLog().info("Replacing " + oldFile + " with " + newFile); + getLog().debug("Replacing " + oldFile + " with " + newFile); File origFile = new File(outputDirectory, "original-" + oldFile.getName()); if (oldFile.exists() && !oldFile.renameTo(origFile)) { @@ -969,7 +970,7 @@ } if (jars.isEmpty()) { - getLog().info("No artifact matching filter " + filter.getArtifact()); + getLog().debug("No artifact matching filter " + filter.getArtifact()); continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java 2025-09-10 00:53:28.000000000 +0200 @@ -174,6 +174,7 @@ return false; } + @Override public boolean canRelocatePath(String path) { if (rawString) { return Pattern.compile(pathPattern).matcher(path).find(); @@ -192,10 +193,12 @@ return isIncluded(path) && !isExcluded(path) && path.startsWith(pathPattern); } + @Override public boolean canRelocateClass(String clazz) { return !rawString && clazz.indexOf('/') < 0 && canRelocatePath(clazz.replace('.', '/')); } + @Override public String relocatePath(String path) { if (rawString) { return path.replaceAll(pathPattern, shadedPathPattern); @@ -204,10 +207,12 @@ } } + @Override public String relocateClass(String clazz) { return rawString ? clazz : clazz.replaceFirst(pattern, shadedPattern); } + @Override public String applyToSourceContent(String sourceContent) { if (rawString) { return sourceContent; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/AbstractCompatibilityTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/AbstractCompatibilityTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/AbstractCompatibilityTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/AbstractCompatibilityTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -28,6 +28,7 @@ * An abstract class to implement once the old non-reproducible ResourceTransformer API. */ abstract class AbstractCompatibilityTransformer implements ReproducibleResourceTransformer { + @Override public final void processResource(String resource, InputStream is, List<Relocator> relocators) throws IOException { processResource(resource, is, relocators, 0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -35,21 +35,25 @@ private static final String LICENSE_MD_PATH = "META-INF/LICENSE.md"; + @Override public boolean canTransformResource(String resource) { return LICENSE_PATH.equalsIgnoreCase(resource) || LICENSE_TXT_PATH.regionMatches(true, 0, resource, 0, LICENSE_TXT_PATH.length()) || LICENSE_MD_PATH.regionMatches(true, 0, resource, 0, LICENSE_MD_PATH.length()); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { // no op } + @Override public boolean hasTransformedResource() { return false; } + @Override public void modifyOutputStream(JarOutputStream os) throws IOException { // no op } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -79,12 +79,14 @@ private static final String NOTICE_MD_PATH = "META-INF/NOTICE.md"; + @Override public boolean canTransformResource(String resource) { return NOTICE_PATH.equalsIgnoreCase(resource) || NOTICE_TXT_PATH.equalsIgnoreCase(resource) || NOTICE_MD_PATH.equalsIgnoreCase(resource); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { if (entries.isEmpty()) { @@ -167,10 +169,12 @@ } } + @Override public boolean hasTransformedResource() { return true; } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { JarEntry jarEntry = new JarEntry(NOTICE_PATH); jarEntry.setTime(time); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/AppendingTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -38,10 +38,12 @@ private long time = Long.MIN_VALUE; + @Override public boolean canTransformResource(String r) { return resource != null && resource.equalsIgnoreCase(r); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { IOUtil.copy(is, data); @@ -51,10 +53,12 @@ } } + @Override public boolean hasTransformedResource() { return data.size() > 0; } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { JarEntry jarEntry = new JarEntry(resource); jarEntry.setTime(time); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ComponentsXmlResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -47,16 +47,19 @@ public static final String COMPONENTS_XML_PATH = "META-INF/plexus/components.xml"; + @Override public boolean canTransformResource(String resource) { return COMPONENTS_XML_PATH.equals(resource); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { Xpp3Dom newDom; try { BufferedInputStream bis = new BufferedInputStream(is) { + @Override public void close() throws IOException { // leave ZIP open } @@ -117,6 +120,7 @@ } } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { JarEntry jarEntry = new JarEntry(COMPONENTS_XML_PATH); jarEntry.setTime(time); @@ -130,6 +134,7 @@ components.clear(); } + @Override public boolean hasTransformedResource() { return !components.isEmpty(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/DontIncludeResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -34,6 +34,7 @@ List<String> resources; + @Override public boolean canTransformResource(String r) { if ((resource != null && !resource.isEmpty()) && r.endsWith(resource)) { return true; @@ -50,15 +51,18 @@ return false; } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { // no op } + @Override public boolean hasTransformedResource() { return false; } + @Override public void modifyOutputStream(JarOutputStream os) throws IOException { // no op } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/IncludeResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/IncludeResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/IncludeResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/IncludeResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -40,10 +40,12 @@ private long time = Long.MIN_VALUE; + @Override public boolean canTransformResource(String r) { return false; } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { if (time > this.time) { @@ -51,10 +53,12 @@ } } + @Override public boolean hasTransformedResource() { return file != null && file.exists(); } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { JarEntry jarEntry = new JarEntry(resource); jarEntry.setTime(time); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/PluginXmlResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -49,16 +49,19 @@ public static final String PLUGIN_XML_PATH = "META-INF/maven/plugin.xml"; + @Override public boolean canTransformResource(String resource) { return PLUGIN_XML_PATH.equals(resource); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { Xpp3Dom newDom; try { BufferedInputStream bis = new BufferedInputStream(is) { + @Override public void close() throws IOException { // leave ZIP open } @@ -116,6 +119,7 @@ } } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { byte[] data = getTransformedResource(); @@ -128,6 +132,7 @@ mojos.clear(); } + @Override public boolean hasTransformedResource() { return !mojos.isEmpty(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ResourceBundleAppendingTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ResourceBundleAppendingTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ResourceBundleAppendingTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ResourceBundleAppendingTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -52,10 +52,12 @@ resourceBundlePattern = Pattern.compile(basename + "(_[a-zA-Z]+){0,3}\\.properties"); } + @Override public boolean canTransformResource(String r) { return resourceBundlePattern != null && resourceBundlePattern.matcher(r).matches(); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { ByteArrayOutputStream data = dataMap.get(resource); @@ -72,10 +74,12 @@ } } + @Override public boolean hasTransformedResource() { return !dataMap.isEmpty(); } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { for (Map.Entry<String, ByteArrayOutputStream> dataEntry : dataMap.entrySet()) { JarEntry jarEntry = new JarEntry(dataEntry.getKey()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/ServicesResourceTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -47,10 +47,12 @@ private long time = Long.MIN_VALUE; + @Override public boolean canTransformResource(String resource) { return resource.startsWith(SERVICES_PATH); } + @Override public void processResource(String resource, InputStream is, final List<Relocator> relocators, long time) throws IOException { resource = resource.substring(SERVICES_PATH.length() + 1); @@ -80,10 +82,12 @@ } } + @Override public boolean hasTransformedResource() { return !serviceEntries.isEmpty(); } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { for (Map.Entry<String, Set<String>> entry : serviceEntries.entrySet()) { String key = entry.getKey(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java --- old/maven-shade-plugin-3.6.0/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/main/java/org/apache/maven/plugins/shade/resource/XmlAppendingTransformer.java 2025-09-10 00:53:28.000000000 +0200 @@ -53,10 +53,12 @@ private long time = Long.MIN_VALUE; + @Override public boolean canTransformResource(String r) { return resource != null && resource.equalsIgnoreCase(r); } + @Override public void processResource(String resource, InputStream is, List<Relocator> relocators, long time) throws IOException { Document r; @@ -65,6 +67,7 @@ builder.setExpandEntities(false); if (ignoreDtd) { builder.setEntityResolver(new EntityResolver() { + @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource(new StringReader("")); @@ -105,10 +108,12 @@ } } + @Override public boolean hasTransformedResource() { return doc != null; } + @Override public void modifyOutputStream(JarOutputStream jos) throws IOException { JarEntry jarEntry = new JarEntry(resource); jarEntry.setTime(time); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/site/apt/index.apt.vm new/maven-shade-plugin-3.6.1/src/site/apt/index.apt.vm --- old/maven-shade-plugin-3.6.0/src/site/apt/index.apt.vm 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/site/apt/index.apt.vm 2025-09-10 00:53:28.000000000 +0200 @@ -53,10 +53,6 @@ {{{./scm.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. -* Version 3.2.0 Hints - - If you like to use <<<minimizeJar>>> this means you have to use JDK8+. This - is based on a required upgrade of dependencies. * Examples diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/site/site.xml new/maven-shade-plugin-3.6.1/src/site/site.xml --- old/maven-shade-plugin-3.6.0/src/site/site.xml 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/site/site.xml 2025-09-10 00:53:28.000000000 +0200 @@ -51,7 +51,7 @@ <body> <menu name="Overview"> <item name="Introduction" href="index.html"/> - <item name="Goals" href="plugin-info.html"> + <item name="Plugin Documentation" href="plugin-info.html"> <item name="shade:shade" href="shade-mojo.html" /> <item name="shade:help" href="help-mojo.html" /> </item> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/DefaultShaderTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -31,6 +31,7 @@ import java.net.URLClassLoader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Paths; import java.nio.file.attribute.FileTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -93,37 +94,37 @@ new String[] {"org/codehaus/plexus/util/xml/Xpp3Dom", "org/codehaus/plexus/util/xml/pull.*"}; @ClassRule - public static final TemporaryFolder tmp = new TemporaryFolder(); + public static final TemporaryFolder TEMPORARY_FOLDER = new TemporaryFolder(); - private final String NEWLINE = "\n"; + private static final String NEWLINE = "\n"; @Test public void testNoopWhenNotRelocated() throws IOException, MojoExecutionException { - final File plexusJar = new File("src/test/jars/plexus-utils-1.4.1.jar"); - final File shadedOutput = new File("target/foo-custom_testNoopWhenNotRelocated.jar"); + File plexusJar = new File("src/test/jars/plexus-utils-1.4.1.jar"); + File shadedOutput = new File("target/foo-custom_testNoopWhenNotRelocated.jar"); - final Set<File> jars = new LinkedHashSet<>(); + Set<File> jars = new LinkedHashSet<>(); jars.add(new File("src/test/jars/test-project-1.0-SNAPSHOT.jar")); jars.add(plexusJar); - final Relocator relocator = new SimpleRelocator( + Relocator relocator = new SimpleRelocator( "org/codehaus/plexus/util/cli", "relocated/plexus/util/cli", - Collections.<String>emptyList(), - Collections.<String>emptyList()); + Collections.emptyList(), + Collections.emptyList()); - final ShadeRequest shadeRequest = new ShadeRequest(); + ShadeRequest shadeRequest = new ShadeRequest(); shadeRequest.setJars(jars); shadeRequest.setRelocators(Collections.singletonList(relocator)); - shadeRequest.setResourceTransformers(Collections.<ResourceTransformer>emptyList()); - shadeRequest.setFilters(Collections.<Filter>emptyList()); + shadeRequest.setResourceTransformers(Collections.emptyList()); + shadeRequest.setFilters(Collections.emptyList()); shadeRequest.setUberJar(shadedOutput); - final DefaultShader shader = newShader(); + DefaultShader shader = newShader(); shader.shade(shadeRequest); - try (final JarFile originalJar = new JarFile(plexusJar); - final JarFile shadedJar = new JarFile(shadedOutput)) { + try (JarFile originalJar = new JarFile(plexusJar); + JarFile shadedJar = new JarFile(shadedOutput)) { // ASM processes all class files. In doing so, it modifies them, even when not relocating anything. // Before MSHADE-391, the processed files were written to the uber JAR, which did no harm, but made it // difficult to find out by simple file comparison, if a file was actually relocated or not. Now, Shade @@ -141,7 +142,7 @@ "relocated/plexus/util/cli/Arg.class")); } int result = 0; - for (final String msg : debugMessages.getAllValues()) { + for (String msg : debugMessages.getAllValues()) { if ("Rewrote class bytecode: org/codehaus/plexus/util/cli/Arg.class".equals(msg)) { result |= 1; } else if ("Keeping original class bytecode: org/codehaus/plexus/util/Expand.class".equals(msg)) { @@ -153,15 +154,15 @@ @Test public void testOverlappingResourcesAreLogged() throws IOException, MojoExecutionException { - final DefaultShader shader = newShader(); + DefaultShader shader = newShader(); // we will shade two jars and expect to see META-INF/MANIFEST.MF overlaps, this will always be true // but this can lead to a broken deployment if intended for OSGi or so, so even this should be logged - final Set<File> set = new LinkedHashSet<>(); + Set<File> set = new LinkedHashSet<>(); set.add(new File("src/test/jars/test-project-1.0-SNAPSHOT.jar")); set.add(new File("src/test/jars/plexus-utils-1.4.1.jar")); - final ShadeRequest shadeRequest = new ShadeRequest(); + ShadeRequest shadeRequest = new ShadeRequest(); shadeRequest.setJars(set); shadeRequest.setRelocators(Collections.<Relocator>emptyList()); shadeRequest.setResourceTransformers(Collections.<ResourceTransformer>emptyList()); @@ -215,9 +216,9 @@ ShadeRequest shadeRequest = new ShadeRequest(); shadeRequest.setJars(set); - shadeRequest.setRelocators(Collections.<Relocator>emptyList()); - shadeRequest.setResourceTransformers(Collections.<ResourceTransformer>singletonList(transformer)); - shadeRequest.setFilters(Collections.<Filter>emptyList()); + shadeRequest.setRelocators(Collections.emptyList()); + shadeRequest.setResourceTransformers(Collections.singletonList(transformer)); + shadeRequest.setFilters(Collections.emptyList()); shadeRequest.setUberJar(new File("target/foo-custom_testOverlappingResourcesAreLogged.jar")); DefaultShader shaderWithTransformer = newShader(); @@ -226,7 +227,7 @@ assertThat(warnMessages.getAllValues().size(), is(0)); DefaultShader shaderWithoutTransformer = newShader(); - shadeRequest.setResourceTransformers(Collections.<ResourceTransformer>emptyList()); + shadeRequest.setResourceTransformers(Collections.emptyList()); shaderWithoutTransformer.shade(shadeRequest); assertThat( @@ -292,33 +293,33 @@ @Test public void testHandleDirectory() throws Exception { - final File dir = tmp.getRoot(); + final File dir = TEMPORARY_FOLDER.getRoot(); // explode src/test/jars/test-artifact-1.0-SNAPSHOT.jar in this temp dir - try (final JarInputStream in = - new JarInputStream(new FileInputStream("src/test/jars/test-artifact-1.0-SNAPSHOT.jar"))) { + try (JarInputStream in = + new JarInputStream(Files.newInputStream(Paths.get("src/test/jars/test-artifact-1.0-SNAPSHOT.jar")))) { JarEntry nextJarEntry; while ((nextJarEntry = in.getNextJarEntry()) != null) { if (nextJarEntry.isDirectory()) { continue; } - final File out = new File(dir, nextJarEntry.getName()); + File out = new File(dir, nextJarEntry.getName()); forceMkdir(out.getParentFile()); - try (final OutputStream outputStream = new FileOutputStream(out)) { + try (OutputStream outputStream = Files.newOutputStream(out.toPath())) { IOUtil.copy(in, outputStream, (int) Math.max(nextJarEntry.getSize(), 512)); } } } // do shade - final File shade = new File("target/testHandleDirectory.jar"); + File shade = new File("target/testHandleDirectory.jar"); shaderWithPattern("org/shaded/plexus/util", shade, new String[0], singleton(dir)); // ensure directory was shaded properly - try (final JarFile jar = new JarFile(shade)) { - final List<String> entries = new ArrayList<>(); - final Enumeration<JarEntry> jarEntryEnumeration = jar.entries(); + try (JarFile jar = new JarFile(shade)) { + List<String> entries = new ArrayList<>(); + Enumeration<JarEntry> jarEntryEnumeration = jar.entries(); while (jarEntryEnumeration.hasMoreElements()) { - final JarEntry jarEntry = jarEntryEnumeration.nextElement(); + JarEntry jarEntry = jarEntryEnumeration.nextElement(); if (jarEntry.isDirectory()) { continue; } @@ -346,8 +347,8 @@ List<Relocator> relocators = new ArrayList<>(); - relocators.add(new SimpleRelocator( - "org/codehaus/plexus/util/", "_plexus/util/__", null, Collections.<String>emptyList())); + relocators.add( + new SimpleRelocator("org/codehaus/plexus/util/", "_plexus/util/__", null, Collections.emptyList())); List<ResourceTransformer> resourceTransformers = new ArrayList<>(); @@ -373,8 +374,8 @@ assertEquals("", c.getMethod("clean", String.class).invoke(o, (String) null)); // now, check that its source file was rewritten: - final String[] source = {null}; - final ClassReader classReader = new ClassReader(cl.getResourceAsStream("_plexus/util/__StringUtils.class")); + String[] source = {null}; + ClassReader classReader = new ClassReader(cl.getResourceAsStream("_plexus/util/__StringUtils.class")); classReader.accept( new ClassVisitor(Opcodes.ASM4) { @Override @@ -448,9 +449,9 @@ ShadeRequest shadeRequest = new ShadeRequest(); shadeRequest.setJars(new LinkedHashSet<>(Collections.singleton(outerJar))); - shadeRequest.setFilters(new ArrayList<Filter>()); - shadeRequest.setRelocators(new ArrayList<Relocator>()); - shadeRequest.setResourceTransformers(new ArrayList<ResourceTransformer>()); + shadeRequest.setFilters(new ArrayList<>()); + shadeRequest.setRelocators(new ArrayList<>()); + shadeRequest.setResourceTransformers(new ArrayList<>()); File shadedFile = temporaryFolder.newFile("shaded.jar"); shadeRequest.setUberJar(shadedFile); @@ -522,7 +523,7 @@ temporaryFolder.create(); File innerJar = temporaryFolder.newFile(innerJarFileName); - try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(innerJar))) { + try (JarOutputStream jos = new JarOutputStream(Files.newOutputStream(innerJar.toPath()))) { jos.putNextEntry(new JarEntry("foo.txt")); byte[] bytes = "c1".getBytes(StandardCharsets.UTF_8); len = bytes.length; @@ -532,9 +533,9 @@ ShadeRequest shadeRequest = new ShadeRequest(); shadeRequest.setJars(new LinkedHashSet<>(Collections.singleton(innerJar))); - shadeRequest.setFilters(new ArrayList<Filter>()); - shadeRequest.setRelocators(new ArrayList<Relocator>()); - shadeRequest.setResourceTransformers(new ArrayList<ResourceTransformer>()); + shadeRequest.setFilters(new ArrayList<>()); + shadeRequest.setRelocators(new ArrayList<>()); + shadeRequest.setResourceTransformers(new ArrayList<>()); File shadedFile = temporaryFolder.newFile("shaded.jar"); shadeRequest.setUberJar(shadedFile); @@ -620,9 +621,9 @@ private boolean areEqual(final JarFile jar1, final JarFile jar2, final String entry1, String entry2) throws IOException { - try (final InputStream s1 = jar1.getInputStream( + try (InputStream s1 = jar1.getInputStream( requireNonNull(jar1.getJarEntry(entry1), entry1 + " in " + jar1.getName())); - final InputStream s2 = jar2.getInputStream( + InputStream s2 = jar2.getInputStream( requireNonNull(jar2.getJarEntry(entry2), entry2 + " in " + jar2.getName()))) { return Arrays.equals(IOUtil.toByteArray(s1), IOUtil.toByteArray(s2)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/relocation/SimpleRelocatorTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -183,7 +183,7 @@ assertTrue(relocator.canRelocatePath("META-INF/maven/com-foo-bar/artifactId/pom.xml")); } - private static final String sourceFile = "package org.apache.maven.hello;\n" + "package org.objectweb.asm;\n" + private static final String SOURCE_FILE = "package org.apache.maven.hello;\n" + "package org.objectweb.asm;\n" + "\n" + "import foo.bar.Bar;\n" + "import zot.baz.Baz;\n" @@ -216,7 +216,7 @@ + " }\n" + "}\n"; - private static final String relocatedFile = "package com.acme.maven.hello;\n" + "package aj.org.objectweb.asm;\n" + private static final String RELOCATED_FILE = "package com.acme.maven.hello;\n" + "package aj.org.objectweb.asm;\n" + "\n" + "import foo.bar.Bar;\n" + "import zot.baz.Baz;\n" @@ -257,7 +257,7 @@ Arrays.asList("foo.bar", "zot.baz"), Arrays.asList("irrelevant.exclude", "org.apache.maven.exclude1", "org.apache.maven.sub.exclude2"), true); - assertEquals(sourceFile, relocator.applyToSourceContent(sourceFile)); + assertEquals(SOURCE_FILE, relocator.applyToSourceContent(SOURCE_FILE)); } @Test @@ -275,8 +275,8 @@ // Make sure not to replace 'foo' package by path-like 'shaded/foo' SimpleRelocator fooRelocator = new SimpleRelocator("foo", "shaded.foo", null, Arrays.asList("foo.bar")); assertEquals( - relocatedFile, + RELOCATED_FILE, fooRelocator.applyToSourceContent(asmRelocator.applyToSourceContent( - ioRelocator.applyToSourceContent(relocator.applyToSourceContent(sourceFile))))); + ioRelocator.applyToSourceContent(relocator.applyToSourceContent(SOURCE_FILE))))); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformerTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformerTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformerTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheLicenseResourceTransformerTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -54,6 +54,7 @@ assertTrue(transformer.canTransformResource("META-INF/LICENSE.TXT")); assertTrue(transformer.canTransformResource("META-INF/LICENSE.md")); assertTrue(transformer.canTransformResource("META-INF/License.txt")); + assertTrue(transformer.canTransformResource("META-INF/License.md")); assertFalse(transformer.canTransformResource("META-INF/MANIFEST.MF")); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerParameterTests.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerParameterTests.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerParameterTests.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerParameterTests.java 1970-01-01 01:00:00.000000000 +0100 @@ -1,90 +0,0 @@ -/* - * 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.plugins.shade.resource; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.plugins.shade.relocation.Relocator; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Tests {@link ApacheLicenseResourceTransformer} parameters. - */ -public class ApacheNoticeResourceTransformerParameterTests { - - private static final String NOTICE_RESOURCE = "META-INF/NOTICE"; - private ApacheNoticeResourceTransformer subject; - - @Before - public void setUp() { - subject = new ApacheNoticeResourceTransformer(); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenNoInput() throws IOException { - processAndFailOnNullPointer(""); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenNoLinesOfInput() throws IOException { - processAndFailOnNullPointer("Some notice text"); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenOneLineOfInput() throws IOException { - processAndFailOnNullPointer("Some notice text\n"); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenTwoLinesOfInput() throws IOException { - processAndFailOnNullPointer("Some notice text\nSome notice text\n"); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenLineStartsWithSlashSlash() throws IOException { - processAndFailOnNullPointer("Some notice text\n//Some notice text\n"); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenLineIsSlashSlash() throws IOException { - processAndFailOnNullPointer("//\n"); - } - - @Test - public void testNoParametersShouldNotThrowNullPointerWhenLineIsEmpty() throws IOException { - processAndFailOnNullPointer("\n"); - } - - private void processAndFailOnNullPointer(final String noticeText) throws IOException { - try { - final ByteArrayInputStream noticeInputStream = new ByteArrayInputStream(noticeText.getBytes()); - final List<Relocator> emptyList = Collections.emptyList(); - subject.processResource(NOTICE_RESOURCE, noticeInputStream, emptyList, 0); - noticeInputStream.close(); - } catch (NullPointerException e) { - fail("Null pointer should not be thrown when no parameters are set."); - } - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ApacheNoticeResourceTransformerTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -18,13 +18,19 @@ */ package org.apache.maven.plugins.shade.resource; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Locale; +import org.apache.maven.plugins.shade.relocation.Relocator; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * Test for {@link ApacheNoticeResourceTransformer}. @@ -33,6 +39,7 @@ */ public class ApacheNoticeResourceTransformerTest { + private static final String NOTICE_RESOURCE = "META-INF/NOTICE"; private ApacheNoticeResourceTransformer transformer; static { @@ -54,6 +61,53 @@ assertTrue(transformer.canTransformResource("META-INF/NOTICE.TXT")); assertTrue(transformer.canTransformResource("META-INF/NOTICE.md")); assertTrue(transformer.canTransformResource("META-INF/Notice.txt")); + assertTrue(transformer.canTransformResource("META-INF/Notice.md")); assertFalse(transformer.canTransformResource("META-INF/MANIFEST.MF")); } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenNoInput() throws IOException { + processAndFailOnNullPointer(""); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenNoLinesOfInput() throws IOException { + processAndFailOnNullPointer("Some notice text"); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenOneLineOfInput() throws IOException { + processAndFailOnNullPointer("Some notice text\n"); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenTwoLinesOfInput() throws IOException { + processAndFailOnNullPointer("Some notice text\nSome notice text\n"); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenLineStartsWithSlashSlash() throws IOException { + processAndFailOnNullPointer("Some notice text\n//Some notice text\n"); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenLineIsSlashSlash() throws IOException { + processAndFailOnNullPointer("//\n"); + } + + @Test + public void testNoParametersShouldNotThrowNullPointerWhenLineIsEmpty() throws IOException { + processAndFailOnNullPointer("\n"); + } + + private void processAndFailOnNullPointer(final String noticeText) throws IOException { + try { + final ByteArrayInputStream noticeInputStream = new ByteArrayInputStream(noticeText.getBytes()); + final List<Relocator> emptyList = Collections.emptyList(); + transformer.processResource(NOTICE_RESOURCE, noticeInputStream, emptyList, 0); + noticeInputStream.close(); + } catch (NullPointerException e) { + fail("Null pointer should not be thrown when no parameters are set."); + } + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformerTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformerTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformerTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ManifestResourceTransformerTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -85,8 +85,8 @@ final ByteArrayOutputStream out = transform(manifest, relocators); - try (final JarInputStream jis = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { - final Attributes attrs = jis.getManifest().getMainAttributes(); + try (JarInputStream jis = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { + Attributes attrs = jis.getManifest().getMainAttributes(); assertEquals( "jakarta.decorator;version=\"2.0\";uses:=\"jakarta.enterprise.inject\"," + "jakarta.enterprise.context;version=\"2.0\";uses:=\"jakarta.enterprise.util," @@ -131,22 +131,22 @@ transformer.setAdditionalAttributes(Arrays.asList("description-custom", "attribute-unknown")); final ByteArrayOutputStream out = transform(manifest, relocators); - try (final JarInputStream jis = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { - final Attributes attrs = jis.getManifest().getMainAttributes(); + try (JarInputStream jis = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { + Attributes attrs = jis.getManifest().getMainAttributes(); assertEquals("This jar uses jakarta packages", attrs.getValue("description-custom")); } } private ByteArrayOutputStream transform(final Manifest manifest, List<Relocator> relocators) throws IOException { final ByteArrayOutputStream mboas = new ByteArrayOutputStream(); - try (final OutputStream mos = mboas) { + try (OutputStream mos = mboas) { manifest.write(mos); } transformer.processResource( JarFile.MANIFEST_NAME, new ByteArrayInputStream(mboas.toByteArray()), relocators, 0); final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (final JarOutputStream jarOutputStream = new JarOutputStream(out)) { + try (JarOutputStream jarOutputStream = new JarOutputStream(out)) { transformer.modifyOutputStream(jarOutputStream); } return out; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/ServiceResourceTransformerTest.java 2025-09-10 00:53:28.000000000 +0200 @@ -44,9 +44,9 @@ * Test for handling META-INF/service/... */ public class ServiceResourceTransformerTest { - private final String NEWLINE = "\n"; + private final String newline = "\n"; - private List<Relocator> relocators = new ArrayList<Relocator>(); + private final List<Relocator> relocators = new ArrayList<>(); @Test public void relocatedClasses() throws Exception { @@ -76,7 +76,7 @@ assertNotNull(jarEntry); try (InputStream entryStream = jarFile.getInputStream(jarEntry)) { String xformedContent = IOUtils.toString(entryStream, "utf-8"); - assertEquals("borg.foo.Service" + NEWLINE + "org.foo.exclude.OtherService" + NEWLINE, xformedContent); + assertEquals("borg.foo.Service" + newline + "org.foo.exclude.OtherService" + newline, xformedContent); } finally { jarFile.close(); } @@ -91,8 +91,8 @@ new SimpleRelocator("org.foo", "borg.foo", null, Collections.singletonList("org.foo.exclude.*")); relocators.add(relocator); - String content = "org.foo.Service" + NEWLINE + "org.foo.exclude.OtherService" + NEWLINE; - String contentShaded = "borg.foo.Service" + NEWLINE + "org.foo.exclude.OtherService" + NEWLINE; + String content = "org.foo.Service" + newline + "org.foo.exclude.OtherService" + newline; + String contentShaded = "borg.foo.Service" + newline + "org.foo.exclude.OtherService" + newline; byte[] contentBytes = content.getBytes(StandardCharsets.UTF_8); String contentResource = "META-INF/services/org.foo.something.another"; String contentResourceShaded = "META-INF/services/borg.foo.something.another"; @@ -154,7 +154,7 @@ assertNotNull(jarEntry); try (InputStream entryStream = jarFile.getInputStream(jarEntry)) { String xformedContent = IOUtils.toString(entryStream, StandardCharsets.UTF_8); - assertEquals("org.eclipse1234.osgi.launch.EquinoxFactory" + NEWLINE, xformedContent); + assertEquals("org.eclipse1234.osgi.launch.EquinoxFactory" + newline, xformedContent); } finally { jarFile.close(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/rule/TransformerTesterRule.java new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/rule/TransformerTesterRule.java --- old/maven-shade-plugin-3.6.0/src/test/java/org/apache/maven/plugins/shade/resource/rule/TransformerTesterRule.java 2024-05-28 15:15:36.000000000 +0200 +++ new/maven-shade-plugin-3.6.1/src/test/java/org/apache/maven/plugins/shade/resource/rule/TransformerTesterRule.java 2025-09-10 00:53:28.000000000 +0200 @@ -52,22 +52,22 @@ public class TransformerTesterRule implements TestRule { @Override - public Statement apply(final Statement base, final Description description) { + public Statement apply(Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { - final TransformerTest spec = description.getAnnotation(TransformerTest.class); + TransformerTest spec = description.getAnnotation(TransformerTest.class); if (spec == null) { base.evaluate(); return; } - final Map<String, String> jar; + Map<String, String> jar; try { - final ReproducibleResourceTransformer transformer = createTransformer(spec); + ReproducibleResourceTransformer transformer = createTransformer(spec); visit(spec, transformer); jar = captureOutput(transformer); - } catch (final Exception ex) { + } catch (Exception ex) { if (Exception.class.isAssignableFrom(spec.expectedException())) { assertTrue( ex.getClass().getName(), @@ -82,7 +82,7 @@ }; } - private void asserts(final TransformerTest spec, final Map<String, String> jar) { + private void asserts(TransformerTest spec, Map<String, String> jar) { if (spec.strictMatch() && jar.size() != spec.expected().length) { fail("Strict match test failed: " + jar); } @@ -95,14 +95,14 @@ } } - private Map<String, String> captureOutput(final ReproducibleResourceTransformer transformer) throws IOException { - final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (final JarOutputStream jar = new JarOutputStream(out)) { + private Map<String, String> captureOutput(ReproducibleResourceTransformer transformer) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try (JarOutputStream jar = new JarOutputStream(out)) { transformer.modifyOutputStream(jar); } - final Map<String, String> created = new HashMap<>(); - try (final JarInputStream jar = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { + Map<String, String> created = new HashMap<>(); + try (JarInputStream jar = new JarInputStream(new ByteArrayInputStream(out.toByteArray()))) { JarEntry entry; while ((entry = jar.getNextJarEntry()) != null) { created.put(entry.getName(), read(jar)); @@ -111,9 +111,8 @@ return created; } - private void visit(final TransformerTest spec, final ReproducibleResourceTransformer transformer) - throws IOException { - for (final Resource resource : spec.visited()) { + private void visit(TransformerTest spec, ReproducibleResourceTransformer transformer) throws IOException { + for (Resource resource : spec.visited()) { if (transformer.canTransformResource(resource.path())) { transformer.processResource( resource.path(), @@ -124,9 +123,9 @@ } } - private String read(final JarInputStream jar) throws IOException { - final StringBuilder builder = new StringBuilder(); - final byte[] buffer = new byte[512]; + private String read(JarInputStream jar) throws IOException { + StringBuilder builder = new StringBuilder(); + byte[] buffer = new byte[512]; int read; while ((read = jar.read(buffer)) >= 0) { builder.append(new String(buffer, 0, read)); @@ -134,22 +133,22 @@ return builder.toString(); } - private ReproducibleResourceTransformer createTransformer(final TransformerTest spec) { - final ConverterLookup lookup = new DefaultConverterLookup(); + private ReproducibleResourceTransformer createTransformer(TransformerTest spec) { + ConverterLookup lookup = new DefaultConverterLookup(); try { - final ConfigurationConverter converter = lookup.lookupConverterForType(spec.transformer()); - final PlexusConfiguration configuration = new DefaultPlexusConfiguration("configuration"); - for (final Property property : spec.configuration()) { + ConfigurationConverter converter = lookup.lookupConverterForType(spec.transformer()); + PlexusConfiguration configuration = new DefaultPlexusConfiguration("configuration"); + for (Property property : spec.configuration()) { configuration.addChild(property.name(), property.value()); } - return ReproducibleResourceTransformer.class.cast(converter.fromConfiguration( + return (ReproducibleResourceTransformer) converter.fromConfiguration( lookup, configuration, spec.transformer(), spec.transformer(), Thread.currentThread().getContextClassLoader(), - new DefaultExpressionEvaluator())); - } catch (final ComponentConfigurationException e) { + new DefaultExpressionEvaluator()); + } catch (ComponentConfigurationException e) { throw new IllegalStateException(e); } }
