Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

The name of the "proguarded" JAR under target/ is different from the one installed under .m2. #108

Open
wheredevel opened this issue Mar 29, 2020 · 2 comments

Comments

@wheredevel
Copy link

wheredevel commented Mar 29, 2020

Here's the portion of the plugin configuration:

				<plugin>
					<groupId>com.github.wvengen</groupId>
					<artifactId>proguard-maven-plugin</artifactId>
					<version>${proguard-maven-plugin.version}</version>
					<configuration>
						<attach>true</attach>
						<attachArtifactClassifier>obfuscated</attachArtifactClassifier>
					...
					<configuration>
				</plugin>

Here's the portion of the plugin execution:

					<plugin>
						<groupId>com.github.wvengen</groupId>
						<artifactId>proguard-maven-plugin</artifactId>
						<executions>
							<execution>
								<phase>package</phase>
								<configuration>
									<injar>${project.build.finalName}-shaded.jar</injar>
								</configuration>
								<goals>
									<goal>proguard</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

With the above configuration and execution, the resulting JAR name under target/ is:
xxxxxxx-shaded-obfuscated.jar

While the installed JAR (under .m2) name is:
xxxxxxx-obfuscated.jar

The expected behavior is that in both cases the name would be:
xxxxxxx-obfuscated.jar
(as it's based on the ${project.build.finalName} with an addition of attachArtifactClassifier value.)

So, the erroneous behavior is that the classifier is appended to the injar named file, instead of the project main artifact name.

Affected version of the plugin: 2.2.0. (Same happens also with 2.0.14.)

@wheredevel wheredevel changed the title The name of the "proguarded" JAR under target/ is different from the one installed. The name of the "proguarded" JAR under target/ is different from the one installed under .m2. Mar 29, 2020
@rhoehener
Copy link

rhoehener commented Aug 25, 2024

Any plans to address this? Feeding <artifactId>-<version>-shaded.jar to the proguard plugin seems to be one of the major use cases.

This behavior makes it impossible to reference the output of the proguard plugin in an assembly descriptor. E.g. this fails because the proguard plugin generates a file named <artifactId>-<version>-shaded-obfuscated.jar, but attaches it with the classifier -obfuscated, and the assembly plugin cannot find it because it looks for <artifactId>-<version>-obfuscated.jar:

   <dependencySet>
      [...]
      <includes>
        <include>${project.groupId}:${project.artifactId}:jar:obfuscated</include>
      </includes>
    </dependencySet>

To workaround, we have to use <attach>false</attach> and sepearately attach the outJar with the build-helper-maven-plugin in order for the assembly descriptor to work as expected.

Edit:

My bad, the assembly descriptor was missing <useProjectAttachments>true</useProjectAttachments> in the dependencySet configuration in order to be able to resolve attached artifacts.

The file in the target folder does still have a different name than the one installed in the local repo, though.

@lasselindqvist
Copy link
Collaborator

This will be addressed if someone provides a fix for it in the form of a pull request. Otherwise no plans to fix this myself.

The code related to this is relatively simple here https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java#L450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants