2011-09-13 9 views
1

こんにちは私はデスクトップマシンにHibernate v4.0.0.CR2をインストールしようとしています.Mavenを操作する必要があります。Mavenビルドエラー

私はMavenに必要な環境変数を設定し、コマンドラインからmavenをビルドしようとしています。私は(私のデスクトップ上にある)のMavenのbinディレクトリからコマンドプロンプトで「MVN 3.0.3」コマンドを実行すると、私はエラーを取得する:

私のpom.xmlファイルがでbinディレクトリにある
D:\Documents and Settings\user\Desktop\apache-maven-3.0.3\bin>mvn 
3.0.3 [INFO] Scanning for projects... [ERROR] The build could not read 
1 project -> [Help 1] [ERROR] [ERROR] The project 
org.hibernate.tutorials:hibernate-tutorial:1.0.0-SNAPSHOT 
(D:\Documents and 
Settings\user\Desktop\apache-maven-3.0.3\bin\pom.xml) has 4 errors 
[ERROR]  'dependencies.dependency.version' for 
org.hibernate:hibernate-core:j ar is missing. @ line 18, column 21 
[ERROR]  'dependencies.dependency.version' for 
javax.servlet:servlet-api:jar is missing. @ line 24, column 21 [ERROR] 
'dependencies.dependency.version' for org.slf4j:slf4j-simple:jar is 
missing. @ line 30, column 21 [ERROR]  
'dependencies.dependency.version' for javassist:javassist:jar is mis 
sing. @ line 36, column 21 [ERROR] [ERROR] To see the full stack trace 
of the errors, re-run Maven with the -e swit ch. [ERROR] Re-run Maven 
using the -X switch to enable full debug logging. [ERROR] [ERROR] For 
more information about the errors and possible solutions, please rea d 
the following articles: [ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin 
gException D:\Documents and 
Settings\user\Desktop\apache-maven-3.0.3\bin> 

Mavenの:

<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>${artifactId}</finalName> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
     </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> 
     </dependency> 

     <!-- Hibernate uses slf4j for logging, for our purposes here 
use the simple backend --> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-simple</artifactId> 
     </dependency> 

     <!-- Hibernate gives you a choice of bytecode providers 
between cglib and javassist --> 
     <dependency> 
      <groupId>javassist</groupId> 
      <artifactId>javassist</artifactId> 
     </dependency> 
    </dependencies> </project> 

私は、しかし、私はこの問題につまずいてきた仕事で使用するにHibernateの感触を得るために、ウェブサイト上でHibernateのチュートリアルを次しています。

私が間違っていたアイデアはありますか?

ありがとうございました!

答えて

3
  1. HibernateはMavenを必要としません。 Mavenは単なるビルドツールです。
  2. Mavenを実行するコマンドはmvnで、mvn 3.0.3ではありません。
  3. エラーが表示されているので、すべての依存関係にバージョンを指定する必要があります。つまり、<groupId>および<artifactId>とともに、<version>要素を指定する必要があります。
+0

ありがとうございます!ちょうど私が必要なもの – Nacht