我正在尝试运行spring mvc和hibernate项目,我收到以下错误:
无法在项目spring-mvc-tiles-hibernate上执行目标:无法解析项目com.sprin.mvc的依赖项:spring-mvc-tiles-hibernate:war:0.0.1-SNAPSHOT:找不到com。 oracle:ojdbc14:jar:http://192.168.200.35:8080/artifactory/libs-release中的10.4.4被缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析 - > [帮助1]
下面是我的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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sprin.mvc</groupId>
<artifactId>spring-mvc-tiles-hibernate</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>spring-mvc-tiles-hibernate</name>
<url>http://maven.apache.org</url>
<build>
<finalName>spring-mvc-tiles-hibernate</finalName>
<!-- <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version>
<configuration> In version 2.1-alpha-1, this was incorrectly named warSourceExcludes
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> <archive> <manifest>
<addClasspath>true</addClasspath> <classpathPrefix>C:/Users/hunaid.husain/workspace/rest-web-app/target/rest-web-app/WEB-INF/lib/</classpathPrefix>
</manifest> </archive> </configuration> </plugin> </plugins> -->
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.2.2.RELEASE</spring.version>
<java.version>1.6</java.version>
<servlet-api.version>2.5.0</servlet-api.version>
<dwr.version>3.0.0-rc3-SNAPSHOT</dwr.version>
<tiles-version>2.2.2</tiles-version>
<slf4j.version>1.6.1</slf4j.version>
<jackson.version>2.0.4</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- for compile only, your container should have this -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
<!-- Hibernate dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>10.2.0.4.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-servlet</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-template</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<!-- Json via Jackson 2.0 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>displaytag</groupId>
<artifactId>displaytag</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<version>${dwr.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
答案 0 :(得分:2)
我最近处于同样的境地。 Oracle不提供物理上的驱动程序包到maven,但是maven在其存储库中有驱动程序工件。因此,当您在pom.xml中设置依赖项时,实际上只会下载oracle许可证文件。
我的解决方案是下一个:
Pom依赖
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>10.2.0.4.0</version>
</dependency>
在Windows的情况下:
C:\Users\Daniel\.m2\repository\com\oracle\ojdbc\10.2.0.4.0\
这个文件夹里面有一些文件,但没有jar。
从Oracle站点手动下载驱动程序(版本10.2.0.4.0): Oracle JDBC drivers
通过运行
手动将驱动程序安装到maven中 mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc -Dversion=10.2.0.4.0 -Dpackaging=jar
命令中的 com.oracle 和 ojdbc 必须与maven repo路径元素匹配... \。m2 \ repository \ com \的预言强> \的 ojdbc 强> \ 10.2.0.4.0 \
答案 1 :(得分:0)
我认为,您必须检查您的依赖项,因为错误显示的版本与您在pom.xml中的版本不同。你在pom.xml中有这个:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>10.2.0.4.0</version>
</dependency>
错误显示版本10.4.4
,也许你有另一个项目作为依赖项,它有ojdbc 10.4.4。
我希望这些信息可以帮到你。
祝你好运。答案 2 :(得分:0)