Reputation: 2815
I have a webservice that will be referring to an XSD file that is in another project (imported as a dependency). I am able to pull the XSD in using the plugin in the following post. However, this pulls it directly into the source. I would rather have it added to the build directory to avoid committing the file.
If I extract the xsd to my existing project structure:
<outputDirectory>schema</outputDirectory>
It shows up in the .jar. However, if I extract it to the build directory:
<outputDirectory>${project.build.directory}/generated/schema</outputDirectory>
It does not show up in the .jar (even if I add it to the build path).
I think I am missing some fundamental understanding of the maven lifecycle. What do I need to do in order to get a file into the .jar while keeping the file in the build directory?
Upvotes: 0
Views: 388
Reputation: 16374
You can use the Maven Resource Plugin
in order to add additional resources (that will be packed into final archive) and which are not into the usual resource directory aka src/main/resources/:
<project>
...
<build>
...
<resources>
<resource>
<directory>${project.build.directory}/generated/schema</directory>
</resource>
</resources>
...
</build>
...
</project>
Upvotes: 1