Question

So I am working with the Proguard Plugin to obfuscate one of my jars before deploying it to Maven. My goal is to have only the obfuscated jar deployed to Maven.

Currently I noticed that two jars get deployed, myJar.jar and myJar-small.jar (the obfuscated one from proguard). I have confimed that my Nexus index contains both of them and a single pom after being deployed. The problem is that when I add myJar as a maven dependency to another project, the unobfuscated jar is pulled into the project, not the obfuscated jar.

Is there way to only upload the obfuscated jar or to specify which jar should be pulled into other projects?

I have looked at the Proguard options here, but not been able to find much that helps.

Was it helpful?

Solution

For your own use, when you define your dependency, add the classifier tag with a value of small.

<dependency>
  <groupId>myGroup</groupId>
  <artifactId>myJar</artifactId>
  <scope>test</scope>
  <classifier>small</classifier> <!-- <<<<<< like this <<<<<< -->
</dependency>

For publishing, you can manually deploy the artifact with a new classifier as demonstrated here:

http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html

OTHER TIPS

I assume you use the Maven ProGaurd Plugin (http://pyx4me.com/pyx4me-maven-plugins/proguard-maven-plugin).

If you leave the attach parameter on its default false value and do not set anything for outjar, the original artifact is overriden by the obfuscated one. Thus, only the obfuscated version will be deployed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top