Hibernate 系列教程2-创建maven工程

时间:2022-04-30 02:43:07

第1步:通过eclipse新建1个java maven项目。

选择file–>new–>other–>MAVEN PROJECT选项

第2步:New Maven project

选择模版:Artifact Id:maven-archetype-quickstart

包名groupId:com.jege.hibernate

工程/模块名称:Artifact Id:hibernate-single-table

Hibernate 系列教程2-创建maven工程

第3步:修改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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.jege.hibernate</groupId>
<artifactId>hibernate-single-table</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>hibernate-single-table</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate.version>4.3.8.Final</hibernate.version>
<mysql.version>5.1.40</mysql.version>
<junit.version>4.12</junit.version>
<java.version>1.8</java.version>
</properties> <dependencies> <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency> <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency> </dependencies> <build>
<finalName>hibernate-single-table</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

源码地址

https://github.com/je-ge/hibernate

如果觉得我的文章对您有帮助,请予以打赏。您的支持将鼓励我继续创作!谢谢!

Hibernate 系列教程2-创建maven工程

Hibernate 系列教程2-创建maven工程