I put a jaxb.properties file in the package where my classes are where I use a different JAXB provider (as seen in this link Specifying EclipseLink MOXy as Your JAXB Provider) which I use for unmarshalling.
The following occurs:
-
When I run the project from Eclipse/STS the unmarshalling works OK,
since it reads the jaxb.properties file. -
When I build the project with Maven 3 (
mvn clean install), the jaxb.properties file isn’t included in the package – therefore those classes can’t unmarshall XML files successfully. Then I have to manually put the jaxb.properties file by navigating to the deployed app, entering the package and pasting the file.
Solutions? Thanks!
You should put resources(like jaxb.properties) in
src/main/resources.I can’t find any proof/documentation yet, but I am certain that maven will only compile and copy
.javafiles from thesrcfolder.From the documentation it seems clear, that compile will only compile and not copy anything. Therefore only .
javafiles under src/main/java will be handled and everything else ignored.Resources are handled by resources:resources, which is executed automatically. This target copies resources from
src/main/resources.Compile only compiles files from the src folder. Resource files are not java files and will therefore not be copied/compiled to the output directory.