In Maven, you can use maven-resources-plugin
plug-ins to separate the resource files in the src/main/resources directory and generate an independent resource file package.
To use maven-resources-plugin
the plugin, you first need to add the following configuration to your project's pom.xml file:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/resources</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
package
The above configuration will execute the goal in the Maven phase copy-resources
and copy all files in the src/main/resources directory to ${project.build.directory}/resources
the directory.
After executing mvn package
the command, an independent resource file package will be generated, which contains all files in the src/main/resources directory. ${project.build.directory}/resources
This resource file package can be found in the directory.
Please note that this is just a method of separating resource files separately, and may need to be adjusted according to specific needs in actual applications.