【发布时间】:2016-05-16 05:49:29
【问题描述】:
我对编程非常陌生,并且正在学习包含使用 Maven 的 Hibernate 教程。在我尝试使用教程中推荐的命令 mvn 编译或启动我的 HSQLDB 服务器之前,一切似乎都很顺利:
mvn exec:java -Dexec.mainClass="org.hsqldb.Server" -Dexec.args="-database.0 file:target/data/tutorial"
那时我遇到了构建失败,我将在下面包含我的 pom.xml 文件。它似乎告诉我依赖项缺少 pom,但我不知道如何解决这个问题。任何帮助将不胜感激,这样我就可以继续我的学习经历。
<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>org.hibernate.tutorials</groupId>
<artifactId>hibernate-tutorial</artifactId>
<version>1.0.0-snapshot</version>
<name>First Hibernate Tutorial</name>
<build>
<!-- we dont want the version to be part of the generated war file name -->
<finalName>${project.artifactId}</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.7.final</version>
</dependency>
<!-- Because this is a web app, we also have a dependency on the servlet api. -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.14</version>
</dependency>
<!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
</dependency>
</dependencies>
【问题讨论】:
-
请注意
<finalName>...</finalName>仅处理本地目录target中的名称,但不会影响通过mvn install部署到本地存储库或远程存储库mvn deploy中的名称....如果您在 Eclipse 之类的 IDE 中工作,那没关系... -
有什么选择?
-
别无选择,因为您不需要更改名称...如果您在 exec-maven-plugin 中运行,则可以使用默认值等...
标签: java hibernate maven dependencies pom.xml