Guardsquare / proguard

ProGuard, Java optimizer and obfuscator
https://www.guardsquare.com/en/products/proguard
GNU General Public License v2.0
2.82k stars 406 forks source link

multi module dependency problem #431

Open yylstudy opened 4 weeks ago

yylstudy commented 4 weeks ago

After obfuscate of multiple modules, there appears code that is not obfuscate image As shown in the picture fzhx-starter-core refers to fzhx-core, and the proguard man plugin is added to fzhx-starter-core. The complete pom is.

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>fzhx-starter</artifactId>
        <groupId>com.zyaud.fzhx</groupId>
        <version>2.0.2-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>fzhx-starter-core</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.zyaud.fzhx</groupId>
            <artifactId>fzhx-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.wvengen</groupId>
                <artifactId>proguard-maven-plugin</artifactId>
                <version>2.6.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>proguard</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <injar>${project.build.finalName}.jar</injar>
                    <outjar>${project.build.finalName}.jar</outjar>
                    <obfuscate>true</obfuscate>
<!--                    <includeDependencyInjar>true</includeDependencyInjar>-->
                    <putLibraryJarsInTempDir>true</putLibraryJarsInTempDir>
                    <proguardInclude>${project.basedir}/proguard.cfg</proguardInclude>
                    <!-- 额外的jar包,通常是项目编译所需要的jar -->
                    <libs>
                        <lib>${java.home}/lib/rt.jar</lib>
                        <lib>${java.home}/lib/jce.jar</lib>
                        <lib>${java.home}/lib/jsse.jar</lib>
                    </libs>
                    <assembly>
                        <inclusions>
                            <inclusion>
                                <groupId>com.zyaud.fzhx</groupId>
                                <artifactId>fzhx-core</artifactId>
                            </inclusion>
                        </inclusions>
                    </assembly>
                    <outputDirectory>${project.basedir}/target</outputDirectory>
                    <options>
                    </options>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.guardsquare</groupId>
                        <artifactId>proguard-base</artifactId>
                        <version>7.1.1</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

It can be seen that fzhx-core is configured in the assembly to package fzhx-starter-core. In addition, I introduced fzhx-starter-core in spring-boot-test spring-boot-test pom is image

but found that all dependencies in spring-boot-test depend on fzhx-core, which is not confused. image

fzhx-starter-core contains obfuscated fzhx-core code, which may cause problems. How can I solve this problem? Thank you very much! Is my usage incorrect?