gpt4 book ai didi

java - Maven 构建失败并显示错误消息 Plugin org.apache.maven.plugins :maven-surefire-plugin:2. 12.4 或其依赖项之一无法解析

转载 作者:行者123 更新时间:2023-11-30 08:19:46 27 4
gpt4 key购买 nike

我正在尝试使用 maven 构建一个 java spring 项目(来自 heroku 入门指南的默认项目)。出于某种原因,我不断收到以下错误。机器上网应该没有问题。

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test 
(default-test) on project spring-hibernate-template:
Execution default-test of goal org.apache.maven.plugins:maven-surefire-
plugin:2.12.4:test failed:
Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its
dependencies could not be resolved:
Cannot access central (http://repo.maven.apache.org/maven2) in offline mode and
the artifact org.codehaus.plexus:plexus-utils:jar:1.1 has not been downloaded
from it before.

我的 pom 文件以防有任何帮助。

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>spring-hibernate-template</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>

<properties>
<org.springframework.version>3.1.1.RELEASE</org.springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.10.Final</version>
</dependency>
<dependency>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>7.0.34.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>7.0.34.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

最佳答案

错误信息说是in offline mode .

如果您没有使用 -o 进行构建或 --offline在命令行上可能有一个 <offline/> settings.xml 文件中的元素。

或者,如果您以这种方式构建,也可以通过您的 IDE 应用此设置。

关于java - Maven 构建失败并显示错误消息 Plugin org.apache.maven.plugins :maven-surefire-plugin:2. 12.4 或其依赖项之一无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26582966/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com