I want to obfuscate a project (jar) using ProGuard (Project A). However, this project is dependent on another war (Project B) and uses some of the classes I have developed in B.
I used the solution from this question: Build a jar from a maven project dependent on other project
but it did not work and when I use the command
maven clean install -X
on Project A I get the error:
error: cannot find symbol
or
error: package com.example does not exist
How can I obfuscate this jar?
Edit 1
In POM of Project A I have:
my war dependency:
<dependency> <groupId>com.example</groupId> <artifactId>myWarProject</artifactId> <version>1.0.0-BUILD-SNAPSHOT</version> </dependency>
in build section:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <finalName>DeviceListener</finalName> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <manifestEntries> <Main-Class>com.example.main.Main</Main-Class> <Build-Number>1</Build-Number> </manifestEntries> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
In Project B I have:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>