gpt4 book ai didi

java - Maven ArtifactNotFoundException 故障排除

转载 作者:行者123 更新时间:2023-11-30 09:09:06 25 4
gpt4 key购买 nike

问题:我正在尝试让 Google Protocol Buffers 依赖项正常工作。但没有结果。 Maven 只是无法提取任何 Protocol Buffer 依赖项。

问题 1: 据我了解,标准 Maven 存储库中不存在这种依赖关系,因此我只需要指出一些额外的存储库。 我说得对吗?

问题 2: 如果第一个问题的答案是"is",那么我如何才能获得那个额外存储库的 url? Here是对 maven 依赖项的引用。

错误:

[ERROR] Plugin com.google.protobuf.tools:maven-protoc-plugin:0.3.2 or one of its dependencies could not be resolved: Failure to find com.google.protobuf.to
ols:maven-protoc-plugin:jar:0.3.2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the u
pdate interval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin com.google.protobuf.tools:maven-protoc-plugin:0.3.2 or one of its dependencies could not be resol
ved: Failure to find com.google.protobuf.tools:maven-protoc-plugin:jar:0.3.2 in http://repo.maven.apache.org/maven2 was cached in the local repository, res
olution will not be reattempted until the update interval of central has elapsed or updates are forced
.......
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.google.protobuf.tools:maven-protoc-plugin:jar:0.3.2 in http://rep
o.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or update
s are forced

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

<groupId>groupId</groupId>
<artifactId>JavaSockets</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.protobuf.tools</groupId>
<artifactId>maven-protoc-plugin</artifactId>
<version>0.3.2</version>
<configuration>
<protocExecutable>C:\Users\Clasik\Desktop\Java Sockets</protocExecutable>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>


......
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.google.protobuf.tools:maven-protoc-plugin:jar:0.3.2 in http://repo.ma
ven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates ar
e forced
...............

最佳答案

缺少的依赖项是 maven-protoc-plugin ,而不是 protobuf-java。这个插件是not available in Maven Central .

根据作者的说法,您可以将自托管存储库添加到 pom.xml:

<pluginRepositories>
<pluginRepository>
<id>protoc-plugin</id>
<url>http://sergei-ivanov.github.com/maven-protoc-plugin/repo/releases/</url>
</pluginRepository>
</pluginRepositories>

但我在这里只收到 404。因此,您可以联系作者或查看源代码并在本地存储库中手动安装插件。

关于java - Maven ArtifactNotFoundException 故障排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23193224/

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