Я добавил Знатока JBoss repo к моему файлу pom.xml как это...
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/maven2/</url>
</repository>
</repositories>
И я добавил, в спящем режиме самостоятельно как это...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.1-Final</version>
</dependency>
Но когда я пытаюсь создать свое приложение, я вижу эту ошибку....
Downloading: http://repository.jboss.org/maven2//org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar
[INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository jboss (http://repository.jboss.org/maven2/)
Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar
[INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) org.hibernate:hibernate:jar:3.5.1-Final
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -Dversion=3.5.1-Final -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.hibernate -DartifactId=hibernate -Dversion=3.5.1-Final -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) stakeholdersupdate:stakeholdersupdate:war:1.0
2) org.hibernate:hibernate:jar:3.5.1-Final
----------
1 required artifact is missing.
Как упоминалось в seanizer , артефакт org.hibernate: hibernate: pom: 3.5.1-Final
представляет собой агрегатные модули типа pom
(объединяет модули Hibernate Core). Так что вы действительно можете положиться на него, указав
. Но я бы лично заявил о зависимости от желаемого модуля, например, для Hibernate Entity Manager:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.1-Final</version>
</dependency>
или для Hibernate Core:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.5.1-Final</version>
</dependency>
артефакт гибернации имеет тип pom (то есть это только оболочка для других проектов). сделайте следующее:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.1-Final</version>
<type>pom</type>
</dependency>
(если вы не укажете тип, maven попытается разрешить артефакт как банку, которой в данном случае не существует)
Вот как мне удалось добавить Hibernate и JPA 2 в мой проект
. . .
<repositories>
<repository>
<id>JBoss</id>
<name>The "public-jboss" repository group provides a combined view all JBoss community project artifacts</name>
<layout>default</layout>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
</repositories>
<dependencies>
. . .
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.5-Final</version>
</dependency>
. . .
</dependencies>
. . .