Reputation: 3658
I am using maven jar plugin to package the jar file. But it looks like maven jar plugin just only pack the stuff that stay inside target/classes. I am also want to pack all the classes in target/classes and (resource and class) files from many other directories. How can i do that with maven jar?
Upvotes: 3
Views: 3412
Reputation: 570545
The resource files stays in another folder of project.
If you can't (or just don't want to) put them under src/main/resources
, you can declare additional resource locations using the <resource>
element:
<project>
...
<build>
...
<resources>
<resource>
<directory> [your folder here] </directory>
</resource>
</resources>
...
</build>
...
</project>
See Specifying resource directories.
The other classes are generated classes.
The convention with plugins generating sources it to generate them in target/generated-sources/<tool>
and a well implemented plugin should add the specified path as a source directory (so that generated code would be compiled). When they don't, the Build Helper Maven Plugin can come to the rescue.
If you are generating classes, why don't you generate them in ${project.build.outputDirectory}
(i.e. target/classes
by default)? I don't think you can add a 2nd classes directory anyway.
If this doesn't help, please clarify your exact constraints and requirements.
Upvotes: 3