Pack things other than target / classes with maven jar

I am using the maven jar plugin to pack a jar file. But it looks like the maven jar plugin only packs things that remain inside the target / classes. I also want to pack all classes into target / classes and (resource and class) files from many other directories. How can I do this with maven jar?

+3
source share
1 answer

Resource files are stored in another project folder.

If you cannot (or simply do not want) to place them under src/main/resources, you can declare additional resource locations using the element <resource>:

<project>
 ...
 <build>
   ...
   <resources>
     <resource>
       <directory> [your folder here] </directory>
     </resource>
   </resources>
   ...
 </build>
 ...
</project>

See Specifying Resource Directories .

Other classes are generated classes.

, , target/generated-sources/<tool>, ( ). , Build Helper Maven Plugin .

, ${project.build.outputDirectory} (.. target/classes )? , 2- .

, .

+3

Source: https://habr.com/ru/post/1773139/


All Articles