I'm building and executable-jar but the jar doesn't include the cfg or hbm hibernate 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>
I'm using the following to build it:
mvn clean package shade:shade
I get errors that my hibernate cfg and hbm files cannot be found.
Any ideas? I've burned many BTUs on this already. Thanks in advance.
将这些文件放在src/main/resources
maven从resources
中获取包中的所有内容
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
this solved my problem
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.