proguard-maven-plugin icon indicating copy to clipboard operation
proguard-maven-plugin copied to clipboard

The input is empty. You have to specify one or more '-injars' options

Open takeAction opened this issue 2 weeks ago • 4 comments

spring boot 2.x, jdk 1.8, maven 3.5, proguard 7.2.2 and proguard-maven-plugin 2.6.0. my configuration as follows:

<properties>

		<war.output.dictionary>wars/</war.output.dictionary>

</properties>
....
<build>
		...
		<plugins>
						
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>				
				<configuration>
					<outputDirectory>${war.output.dictionary}</outputDirectory>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.github.wvengen</groupId>
				<artifactId>proguard-maven-plugin</artifactId>
				<version>2.6.0</version>
				<executions>
					<execution>
						<phase>compile</phase>
						<goals>
							<goal>proguard</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<proguardVersion>7.2.2</proguardVersion>
					<obfuscate>true</obfuscate>
					<proguardInclude>E:/proguard.cfg</proguardInclude>
					<libs>
						<lib>${java.home}/lib/rt.jar</lib>
					</libs>
					<injar>classes</injar>
					<outputDirectory>proguard</outputDirectory>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>com.guardsquare</groupId>
						<artifactId>proguard-base</artifactId>
						<version>7.2.2</version>
						<scope>runtime</scope>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
		
		<resources>
			<resource>
				<directory>src/main/resources</directory>  
                <filtering>true</filtering>
                <includes>
                	<include>**/*.properties</include>
                	<include>**/*.yml</include><!-- 也可以指定具体的文件 application-${env}.yml -->
                </includes>                
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<excludes>
					<exclude>**/*.properties</exclude>
					<exclude>**/*.yml</exclude>
				</excludes>
			</resource>
		</resources>
		
	</build>

my project is packaged as war. I want to obfuscate the war or its classes, when I execute mvn clean package in idea, the error thrown:

[proguard] ProGuard, version 7.2.2
 [proguard] Unexpected error
 [proguard] java.io.IOException: The input is empty. You have to specify one or more '-injars' options.
 [proguard] 	at proguard.ConfigurationChecker.check(ConfigurationChecker.java:62) ~[proguard-base-7.2.2.jar:7.2.2]
 [proguard] 	at proguard.ProGuard.checkConfiguration(ProGuard.java:290) ~[proguard-base-7.2.2.jar:7.2.2]
 [proguard] 	at proguard.ProGuard.execute(ProGuard.java:99) ~[proguard-base-7.2.2.jar:7.2.2]
 [proguard] 	at proguard.ProGuard.main(ProGuard.java:623) [proguard-base-7.2.2.jar:7.2.2]

what's the problem? I have set injar as classes and phase of execution as compile.

takeAction avatar Jun 20 '24 03:06 takeAction