开发者

pack stuff other than target/classes with maven jar

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 wi开发者_如何转开发th maven jar?


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.

References

  • Specifying resource directories
  • MavenPropertiesGuide
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜