6
我在命令行中运行“mvn install”并陷入以下错误。Maven找不到已存在于存储库中的工件
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.detux.vios:common-entity:jar:2_0_0:
Could not find artifact org.hibernate:hibernate-entitymanager:jar:3.6.2.FINAL in central (http://repo.maven.apache.org/maven2)
我检查平方米\库\组织\冬眠\冬眠-的EntityManager \ 3.6.2.FINAL \,这里是它的内容
我也试图添加新远程仓库到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>
<parent>
<artifactId>common</artifactId>
<groupId>com.detux.vios</groupId>
<version>2_0_0</version>
</parent>
<groupId>com.detux.vios</groupId>
<artifactId>common-entity</artifactId>
<version>${common.version}</version>
<name>Vios Common entity</name>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>com.detux.vios</groupId>
<artifactId>common-util</artifactId>
<version>${common.version}</version>
</dependency>
</dependencies>
<properties>
</properties>
<repositories>
<repository>
<id>repository.jboss.org-public</id>
<name>JBoss repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
</project>
下面是父项目的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.detux.vios</groupId>
<artifactId>common</artifactId>
<version>2_0_0</version>
<packaging>pom</packaging>
<name>Vios Common</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar-test-classes</id>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<commons-jxpath.version>1.3</commons-jxpath.version>
<common.version>2_0_0</common.version>
<spring.version>3.0.5.RELEASE</spring.version>
<spring.integration.version>2.0.4.RELEASE</spring.integration.version>
<hibernate.version>3.6.2.FINAL</hibernate.version>
<maven-jaxb2-plugin.version>0.7.4</maven-jaxb2-plugin.version>
<commonsbeanutils.version>1.8.3</commonsbeanutils.version>
<commons-lang.version>2.6</commons-lang.version>
</properties>
<modules>
<module>common-model</module>
<module>common-entity</module>
<module>common-storage</module>
<module>common-util</module>
<module>common-service</module>
<module>common-service-business</module>
<module>common-service-resource</module>
<module>common-catalog</module>
<module>common-xml-jaxb2</module>
</modules>
</project>
我从FINAL更改为Final。它然后就像一个魅力。非常感谢。 – bnguyen82 2012-04-03 07:35:22
如果我希望maven使用m2存储库中已有的jar,我从本地团队存储库复制而不是从远程存储库下载,如何配置以实现该目标? – bnguyen82 2012-04-03 07:51:40
@ bnguyen82,如果您尚未找到本地存储库的解决方案,则可以使用-o切换到脱机模式。注意,如果你没有任何已经下载的罐子,你会有一些缺失的工件错误。 – 2013-09-19 10:01:36