Maven项目不打包*.hbm.xml文件

<build>
        <finalName>basic</finalName>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.0-beta-1</version>
                <configuration>
                    <url>http://www.my.com:6789/manager/html</url>
                    <server>tomcat7</server>
                </configuration>
            </plugin>
        </plugins>  

        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.hbm.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>  

    </build> 

还看到有说这样做的,不过使用第一次加进来了,clean一次后又不打包hbm.xml文件。

如果是 jar 包,在 Plugin 中配置:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
        <archive>
          <addMavenDescriptor>false</addMavenDescriptor>
        </archive>
      </configuration>
    </plugin>
  </plugins>
</build>

如果是 war 包,在 Plugin 中配置:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <configuration>
        <archive>
          <addMavenDescriptor>false</addMavenDescriptor>
        </archive>
      </configuration>
    </plugin>
  </plugins>
</build>
时间: 2024-08-09 06:35:11

Maven项目不打包*.hbm.xml文件的相关文章

Maven 项目不打包 *.hbm.xml 映射文件

使用 Maven 部署 Java Web 项目时,Hibernate 的映射文件 *.hbm.xml 没有被打包部署到目标目录下,解决方法:在 pom.xml 文件中 <build> 节点下添加以下代码: 1 <build> 2 …… 3 <resources> 4 <resource> 5 <directory>src/main/java</directory> 6 <includes> 7 <include>

将maven项目中的hbm.xml文件打入jar包中

方法一:本人实际操作过,好用 <build>           <finalName>basic</finalName>           <plugins>               <plugin>                   <groupId>org.codehaus.mojo</groupId>                   <artifactId>tomcat-maven-plug

maven项目中的pom.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion&

通过MyEclipse生成Hibernate类文件和hbm.xml文件

1.    前言 很多人都在使用myEclipse,很多公司也都使用hibernate框架,老版本的hibernate中,由于没有annotation,我们需要写两个文件来维护表与对象的关系,写一个类,就要写一个hbm.xml文件,数据库表比较少就无所谓,但是多了就很麻烦,要一个一个的手写非常浪费时间,还有可能写错.新版的hibernate加入了annotation的形式来映射对象与数据库表之间的关系,虽然不需要写hbm.xml文件了,但是数据库表非常多的情况下,还是需要写很多的类.我们为何不找

Spring,Hibernate 集成解决多hbm.xml文件繁多的方案

开发一个大一点的项目有很多的hbm.xml文件,有时候上百个也不稀奇,如果用 <property name="mappingLocations"> <list> <value>com/tz/entity/Student.hbm.xml</value> </list> </property> 那么每一个hbm.xml文件都要配置一行代码,一百个hbm.xml就要写100行 文件让程序 的可读性,可维护性都变都非常差.

hibernate的.hbm.xml文件文件配置属性详解

一般.hbm.xml文件如下面: 1 <?xml version="1.0"?> 2 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 3 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 4 <!-- Generated 2014-9

hibernate.hbm.xml文件配置入门小结(1)

在Hibernate中,各表的映射文件xxx.hbm.xml可以通过工具生成,例如在使用MyEclipse开发时,它提供了自动生成映射文件的工具. hibernate.hbm.xml文件的基本结构如下: [html] view plain copy print? 1   <?xml version="1.0" encoding='UTF-8'?> 2 3   <!DOCTYPE hibernate-mapping PUBLIC 4        "-//Hi

Hibernate tools 反向生成实体和hbm.xml文件

1 安装hibernate http://tools.jboss.org/downloads/overview.html 通过上面地址或者自己搜索hibernate tools官网找到update site 在eclipse 安装,安装中记住只选择hibernate tools部分即可 2 使用Hibernate tools 生成实体和hbm.xml文件 ① 创建 cfg.xml 右键工程 新建 接下来到对应页面,填写数据库信息生成文件 ② 配置console config ③ 创建reveng

Hibernate中一对多关联的时候hbm.xml文件的配置

body { font-family: 微软雅黑,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif; font-size: 10.5pt; line-height: 1.5; } html, body { } h1 { font-size:1.5em; font-weight:bold; } h2 { font-size:1.4em; font-weight:bold; } h3 { fon