Here I want to take a real case. If you want to change the JAXB provider, you have to put a file named jab.properties in the folder containing jaxb annotated classes. But maven will not copy this file in target by default while building the project.
So, suppose you have put your configuration file into a package, for example the file named:
jaxb.properties
into the package
com.mytroubleshootings
Then you have to add a plugin in your pom.xml, between the <plugins></plugins> tags, in this way:
<plugin> <artifactId>maven-resources-plugin</artifactId> <version> 2.5 </version> <executions> <execution> <id> copy-resources </id> <phase> validate </phase> <goals> <goal> copy-resources </goal> </goals> <configuration> <outputDirectory> ${basedir}/target/classes/intranet/com/mytroubleshootings/ </outputDirectory> <resources> <resource> <directory> ${basedir}/src/main/java/intranet/com/mytroubleshootings/ </directory> <includes> <include> jaxb.properties </include> </includes> </resource> </resources> </configuration> </execution> </executions> </plugin>
You can change the resource directory, the filename, and the output directory as needed.
No comments:
Post a Comment