In the resources in the profile folder there is a configuration file, depending on the profile it should be taken and put in the resource root
Actually, what I encountered
So that the folder itself in the jar does not fall
<plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>${maven-resources-plugin.version}</version> <executions> <execution> <id>copy-properties</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/src/main/resources</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/resources/profile/${profile.dir}</directory> <includes> <include>server.properties</include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ejb-plugin</artifactId> <version>${maven-ejb-plugin.version}</version> <configuration> <filterDeploymentDescriptor>true</filterDeploymentDescriptor> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> <addMavenDescriptor>false</addMavenDescriptor> </archive> <ejbVersion>3.0</ejbVersion> </configuration> </plugin> </plugins>
Tell me where I was wrong? In which plugin to configure maven-ejb-plugin or maven-resources-plugin
I have src/main/recoursces/profile/
I want jar - It did not have a folder profile - and have one server.properties
I'm not sure if I understand your question. I believe the resources phase package
is not correct, it should be on a previous one like process-resources
.
Here you have the Maven Lifecycle Reference
process-resources : copy and process the resources into the destination directory, ready for packaging.
package : take the compiled code and package it in its distributable format, such as a JAR.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.