java - Maven ArtifactNotFoundException 故障排除

标签 java maven protocol-buffers

问题:我正在尝试让 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/

相关文章:

java - 2D游戏中的碰撞

Java:本地缓存和更改

maven - 使用 Maven 创建一个包含所有依赖项的 zip

java - j2objc/usr/local/lib//libprotobuf.a(strutil.o) ld : 55 duplicate symbols for architecture x86_64

javascript - Protocol Buffer 的大小有限制吗?

javascript - 无效的正则表达式::字符类中的范围无序

java - Spring 上传文件

java - 损坏的双链表

java - 如何运行-jar文件(java.lang.NoClassDefFoundError)

java - Spring Boot Maven pom.xml 不存在