Привет, я следую этому уроку: http://www.mastertheboss.com/hibernate/182-hibernate-tutorial.html
Я выполнил весь код, поэтому добавил конфигурацию запуска:
пакет -e -DgroupId = it.michelepierri -DartifactId = FirstExampleHibernate
Это мой 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>it.michele</groupId>
<artifactId>FirstExampleHibernate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>FirstExampleHibernate</name>
<description>Primo esempio di utilizzo Hibernate</description>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core<!--or hibernate-core--></artifactId>
<version>3.3.2.GA</version>
<type>pom</type>
<!--hibernate-dependencies is a pom, not needed for hibernate-core -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.1.0.GA</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.4.GA</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>it.michele.TestPerson</mainClass>
<packageName>it.michele</packageName>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Итак, я запускаю его, и консоль говорит мне:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ FirstExampleHibernate ---
[INFO] Building jar: C:\Users\Michele\workspace\FirstExampleHibernate\target\FirstExampleHibernate-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.707s
[INFO] Finished at: Sun Mar 11 14:59:50 CET 2012
[INFO] Final Memory: 5M/77M
[INFO] ------------------------------------------------------------------------
Когда я пытаюсь запустить банку, я возвращаюсь:
C:\Users\Michele\workspace\FirstExampleHibernate\target>java -jar
FirstExampleHibernate-0.0.1-SNAPSH
OT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/Session
Caused by: java.lang.ClassNotFoundException: org.hibernate.Session
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: it.michelepierri.TestPerson. Program will exit.
Что я делаю не так ??????
В классе TestPerson.java есть открытый метод static void main (String [] args).
Спасибо.