Problem Scenario
When confusing with the MAVEN + Proguard packaging project, the following errors are prompted:
version4.4doesn‘t containthe proper ‘-injars‘ options? [proguard] at proguard.InputReader.execute(InputReader.java:91) [proguard] at proguard.ProGuard.readInput(ProGuard.java:195) [proguard] at proguard.ProGuard.execute(ProGuard.java:78) [proguard] at proguard.ProGuard.main(ProGuard.java:499)
Problem analysis
Missing Injars configuration item!
-injars {Class_path} specifies the application jar,war,ear and directory to be processed
Solution Solutions
Add the Injars configuration item, because it is a Web project, so the war is specified here
<injar>${project.build.finalName}.war</injar>
Complete Example:
<plugin> <groupId>Com.pyx4me</groupId> <artifactid>Proguard-maven-plugin</artifactid> <version>2.0.4</version> <executions> <execution> <phase>Package</phase> <goals> <goal>Proguard</goal> </goals> </Execution> </executions> <configuration> <obfuscate>True</obfuscate> <proguardinclude>${basedir}/proguard.conf</proguardinclude> <!--add dependencies, here you can modify as you need-- <libs> <lib>${java.home}/lib/rt.jar</lib> <lib>Lib/jsp-api.jar</lib> <lib>Lib/servlet-api.jar</lib> </libs> <addmavendescriptor>False</addmavendescriptor> <Injar>${project.build.finalname}.war</Injar> <Outjar>${project.build.finalname}-pg.war</Outjar> <outputdirectory>${project.build.directory}</outputdirectory> </configuration> <dependencies> <!--using version 4.4 to confuse - <dependency> <groupId>Net.sf.proguard</groupId> <artifactid>Proguard</artifactid> <version>4.4</version> <scope>Runtime</Scope> </Dependency> </dependencies> </plugin>
Java.io.IOException:The input doesn ' t contain any classes. Did you specify the proper '-injars ' opt