SoFunction
Updated on 2025-04-04

Troubleshooting issues when gradle and maven are packaged

Exclude gradle and maven when packaging

gradle

processResources {
    exclude('')
}

maven (jar package)

    <build>
        <plugins>
            <plugin>
                <groupId></groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!--Pack and removejarConfiguration files in packages-->
            <plugin>
                <groupId></groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude></exclude>
                        <exclude></exclude>
                    </excludes>
                </configuration>
            </plugin>

        </plugins>
    </build>

maven (war package)

 <build>
        <plugins>
            <plugin>
                <groupId></groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!--Exclude specified directories when packaging-->
            <plugin>
                <groupId></groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <!--<packagingExcludes>WEB-INF/classes/*.properties,WEB-INF/classes/config/**.properties-->
                    <!--</packagingExcludes>-->
                </configuration>
            </plugin>
        </plugins>
    </build>

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.