Maven build does not include hibernate cfg.xml or hbm.xml files

I create and execute-jar, but jar does not include hibernate cfg or hbm files. My pom file contains the following:

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.2</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.myCompany.myProject.myMainClass</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> 

To create it, I use the following:

mvn net package shade: shadow

I get errors that cannot be found in the cbb and hbm hibernate files.

Any ideas? I already burned a lot of BTU. Thanks in advance.

+4
source share
2 answers

put these files in src/main/resources maven accepts everything in the package from resources

+8
source
 <build> <sourceDirectory>src/main/java</sourceDirectory> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build> 

it solved my problem

+5
source

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


All Articles