构建Spring MVC应用程序时出错

时间:2012-10-30 04:16:11

标签: spring spring-mvc maven-3

我是Spring框架的新手。我的系统上安装了JDK 1.7的Spring Tool Suite 3.1.0版。 最近我在我的IDE中导入了一个预先构建的Spring MVC项目,该项目已经在另一个系统上运行。但是当我尝试构建它时,它会给出以下错误: -

Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'vdm'. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5

此外,当我查看Maven的Lifecycycle Mapping时,它会显示: -

enter image description here

我的环境配置如下: -

enter image description here

我的pom.xml是: -

  <?xml version="1.0" encoding="UTF-8" ?> 
- <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.engineersindia</groupId> 
  <artifactId>vdsc</artifactId> 
  <name>abc</name> 
  <packaging>war</packaging> 
  <version>1.0.0-BUILD-SNAPSHOT</version> 
- <properties>
  <java-version>1.6</java-version> 
  <org.springframework-version>3.0.6.RELEASE</org.springframework-version> 
  <org.aspectj-version>1.6.9</org.aspectj-version> 
  <org.slf4j-version>1.5.10</org.slf4j-version> 
  </properties>
- <dependencies>
- <!--  Spring 
  --> 
- <dependency>
  <groupId>org.springframework</groupId> 
  <artifactId>spring-context</artifactId> 
  <version>${org.springframework-version}</version> 
- <exclusions>
- <!--  Exclude Commons Logging in favor of SLF4j 
  --> 
- <exclusion>
  <groupId>commons-logging</groupId> 
  <artifactId>commons-logging</artifactId> 
  </exclusion>
  </exclusions>
  </dependency>
- <dependency>
  <groupId>org.springframework</groupId> 
  <artifactId>spring-webmvc</artifactId> 
  <version>${org.springframework-version}</version> 
  </dependency>
- <!--  AspectJ 
  --> 
- <dependency>
  <groupId>org.aspectj</groupId> 
  <artifactId>aspectjrt</artifactId> 
  <version>${org.aspectj-version}</version> 
  </dependency>
- <!--  Logging 
  --> 
- <dependency>
  <groupId>org.slf4j</groupId> 
  <artifactId>slf4j-api</artifactId> 
  <version>${org.slf4j-version}</version> 
  </dependency>
- <dependency>
  <groupId>org.slf4j</groupId> 
  <artifactId>jcl-over-slf4j</artifactId> 
  <version>${org.slf4j-version}</version> 
  <scope>runtime</scope> 
  </dependency>
- <dependency>
  <groupId>org.slf4j</groupId> 
  <artifactId>slf4j-log4j12</artifactId> 
  <version>${org.slf4j-version}</version> 
  <scope>runtime</scope> 
  </dependency>
- <dependency>
  <groupId>log4j</groupId> 
  <artifactId>log4j</artifactId> 
  <version>1.2.15</version> 
- <exclusions>
- <exclusion>
  <groupId>javax.mail</groupId> 
  <artifactId>mail</artifactId> 
  </exclusion>
- <exclusion>
  <groupId>javax.jms</groupId> 
  <artifactId>jms</artifactId> 
  </exclusion>
- <exclusion>
  <groupId>com.sun.jdmk</groupId> 
  <artifactId>jmxtools</artifactId> 
  </exclusion>
- <exclusion>
  <groupId>com.sun.jmx</groupId> 
  <artifactId>jmxri</artifactId> 
  </exclusion>
  </exclusions>
  <scope>runtime</scope> 
  </dependency>
- <!--  @Inject 
  --> 
- <dependency>
  <groupId>javax.inject</groupId> 
  <artifactId>javax.inject</artifactId> 
  <version>1</version> 
  </dependency>
- <!--  Servlet 
  --> 
- <dependency>
  <groupId>javax.servlet</groupId> 
  <artifactId>servlet-api</artifactId> 
  <version>2.5</version> 
  <scope>provided</scope> 
  </dependency>
- <dependency>
  <groupId>javax.servlet.jsp</groupId> 
  <artifactId>jsp-api</artifactId> 
  <version>2.1</version> 
  <scope>provided</scope> 
  </dependency>
- <dependency>
  <groupId>javax.servlet</groupId> 
  <artifactId>jstl</artifactId> 
  <version>1.2</version> 
  </dependency>
- <!--  Test 
  --> 
- <dependency>
  <groupId>junit</groupId> 
  <artifactId>junit</artifactId> 
  <version>4.7</version> 
  <scope>test</scope> 
  </dependency>
- <dependency>
  <groupId>org.springframework.ldap</groupId> 
  <artifactId>spring-ldap-core</artifactId> 
  <version>1.3.1.RELEASE</version> 
  </dependency>
- <dependency>
  <groupId>org.springframework.security</groupId> 
  <artifactId>spring-security-core</artifactId> 
  <version>3.1.0.M2</version> 
  </dependency>
- <dependency>
  <groupId>org.springframework.security</groupId> 
  <artifactId>spring-security-ldap</artifactId> 
  <version>3.1.0.M2</version> 
  </dependency>
- <dependency>
  <groupId>commons-dbcp</groupId> 
  <artifactId>commons-dbcp</artifactId> 
  <version>1.4</version> 
  </dependency>
- <dependency>
  <groupId>displaytag</groupId> 
  <artifactId>displaytag</artifactId> 
  <version>1.2</version> 
  </dependency>
- <dependency>
  <groupId>org.codehaus.jackson</groupId> 
  <artifactId>jackson-mapper-asl</artifactId> 
  <version>1.5.3</version> 
  </dependency>
- <dependency>
  <groupId>org.hibernate</groupId> 
  <artifactId>hibernate-validator</artifactId> 
  <version>4.1.0.Final</version> 
  </dependency>
- <dependency>
  <groupId>cglib</groupId> 
  <artifactId>cglib</artifactId> 
  <version>2.2</version> 
  </dependency>
- <dependency>
  <groupId>net.sf.jasperreports</groupId> 
  <artifactId>jasperreports-fonts</artifactId> 
  <version>4.7.0</version> 
  </dependency>
- <dependency>
  <groupId>commons-digester</groupId> 
  <artifactId>commons-digester</artifactId> 
  <version>2.1</version> 
  </dependency>
- <dependency>
  <groupId>org.codehaus.groovy</groupId> 
  <artifactId>groovy</artifactId> 
  <version>1.7.11</version> 
  </dependency>
- <dependency>
  <groupId>net.sf.jasperreports</groupId> 
  <artifactId>jasperreports</artifactId> 
  <version>4.7.0</version> 
  </dependency>
- <dependency>
  <groupId>com.lowagie</groupId> 
  <artifactId>itext</artifactId> 
  <version>2.1.7</version> 
  </dependency>
  </dependencies>
- <build>
- <plugins>
- <plugin>
  <groupId>org.apache.maven.plugins</groupId> 
  <artifactId>maven-compiler-plugin</artifactId> 
- <configuration>
  <source>${java-version}</source> 
  <target>${java-version}</target> 
  </configuration>
  </plugin>
- <plugin>
  <groupId>org.apache.maven.plugins</groupId> 
  <artifactId>maven-war-plugin</artifactId> 
- <configuration>
  <warName>abc</warName> 
  </configuration>
  </plugin>
- <plugin>
  <groupId>org.apache.maven.plugins</groupId> 
  <artifactId>maven-dependency-plugin</artifactId> 
- <executions>
- <execution>
  <id>install</id> 
  <phase>install</phase> 
- <goals>
  <goal>sources</goal> 
  </goals>
  </execution>
  </executions>
  </plugin>
- <plugin>
  <groupId>org.apache.maven.plugins</groupId> 
  <artifactId>maven-resources-plugin</artifactId> 
  <version>2.5</version> 
- <configuration>
  <encoding>UTF-8</encoding> 
  </configuration>
  </plugin>
  </plugins>
  </build>
  </project>

即使我将项目作为Maven项目导入,在检索列表后,也会出现以下错误: -

enter image description here

1 个答案:

答案 0 :(得分:1)

您可以在以下路径中查看该文件夹的内容吗。

C:\Users\{your computer user name}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.5

如果您没有找到此文件夹或者没有内容,那么您必须检查eclipse的代理配置,或者您可能正在引用maven的错误settings.xml文件。

希望这会对你有所帮助。