gpt4 book ai didi

java - 无法解决maven依赖关系

转载 作者:行者123 更新时间:2023-12-02 04:04:56 24 4
gpt4 key购买 nike

<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.microservice.voucher</groupId>
<artifactId>voucher</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>VoucherMicroService</name>
<description>microservice project for Spring Boot</description>

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Angel.SR3</version>
</parent>

<properties>
<!-- Stand-alone RESTFul application for testing only -->
<start-class>com.microservice.service.Main</start-class>
</properties>

<dependencies>
<dependency>
<!-- Setup Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<!-- Setup Spring MVC & REST, use Embedded Tomcat -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
<!-- Setup Spring Data common components -->
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>

<dependency>
<!-- Testing starter -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

<dependency>
<!-- Setup Spring Data JPA Repository support -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<!-- In-memory database for testing/demos -->
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>

<dependency>
<!-- Spring Cloud starter -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>

<dependency>
<!-- Eureka service registration -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1201-jdbc41</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.1</artifactId>
<version>2.1.5</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

这是我的 pom 文件

<小时/>

我正在将 Maven 项目导入到 sts,该项目来自 Windows,现在我正在尝试导入到 ubuntu。

这样的错误消息

Could not get the value for parameter encoding for plugin execution default-resources
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-project:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-artifact:jar:2.0.6: Failure to transfer org.apache.maven:maven-project:jar:2.0.6 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-project:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

最佳答案

在两种情况下你会得到上面的错误

  1. 如果maven中央存储库没有请求的jar
  2. 如果无法访问maven中央存储库进行下载。

您的情况属于情况 2。我可以在 https://repo1.maven.org/maven2/org/apache/maven/maven-project/2.0.6/ 的中央存储库中看到 jar 文件之一。

检查 maven settings.xml 文件中的 intenet/proxy 设置。输入您的代理主机和端口值。

我粘贴下面的示例代理设置。

<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>

关于java - 无法解决maven依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34429374/

24 4 0
文章推荐: java - 复制 pdf 时出现 iText 'java.io.IOException The document has no pages'
文章推荐: java - 单例、静态或接口(interface)作为常量字段?
文章推荐: java - 使用 Git 将 Java 应用程序部署到 Heroku
文章推荐: java - 作为变量传递时,Thymeleaf 片段无法解析,即
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com