Maven:com.example.speech:speech-google-cloud-samples 的不可解析父 POM

Maven: Non Resolvable parent POM for com.example.speech:speech-google-cloud-samples

我尝试使用来自 github 的 google 语音客户端将语音转为文本:
https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/speech/cloud-client

在 pom.xml 中显示了以下问题
描述资源路径位置类型 生命周期配置未涵盖的插件执行:org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /speech-google- cloud-samples 第 23 行 Maven 项目构建生命周期映射问题

我该如何解决这个问题?抱歉代码太长了..

<project>
 <modelVersion>4.0.0</modelVersion>
  <groupId>com.example.speech</groupId>
  <artifactId>speech-google-cloud-samples</artifactId>
  <packaging>jar</packaging>

  <!-- Parent defines config for testing & linting. -->
 <parent>
    <artifactId>doc-samples</artifactId>
    <groupId>com.google.cloud</groupId>
    <version>1.0.0</version>
  <relativePath>../..</relativePath>
  </parent> 

  <properties>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <!-- FIXME(lesv) - temp to fix an issue w/ GA Datastore -->
<!--
  <dependencyManagement>
    <dependencies>
      <dependency>
          <groupId>io.grpc</groupId>
          <artifactId>grpc-core</artifactId>
          <version>1.2.0</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
 -->

  <dependencies>
    <!-- [START dependencies] -->
 <!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-speech -->
<dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-speech</artifactId>
    <version>0.17.2-alpha</version>
</dependency>

    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>gax</artifactId>
      <version>1.1.0</version>
      <exclusions>
        <exclusion> <!-- exclude an old version of Guava -->
          <groupId>com.google.guava</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>4.1.8.Final</version>
</dependency>

    <!-- https://mvnrepository.com/artifact/io.grpc/grpc-core -->
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-core</artifactId>
        <version>1.2.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
        <version>4.1.8.Final</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java-util -->
    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java-util</artifactId>
        <version>3.2.0</version>
    </dependency>



    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>gax-grpc</artifactId>
      <version>0.17.0</version>
      <exclusions>
        <exclusion> <!-- exclude an old version of Guava -->
          <groupId>com.google.guava</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- [END dependencies] -->

    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.truth</groupId>
      <artifactId>truth</artifactId>
      <version>0.32</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.example.language.QuickstartSample</mainClass>
            </manifest>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
` 

您的标题和post的内容显示出两个不同的问题。我将对您的 post.

内容中描述的内容做出回应

你的问题是经典的eclipse-integration问题;也就是说,您需要指示 eclipse 如何处理您的 pom 引用的各种插件(您可能想忽略它们)。

所以在你的情况下,你需要在你的 pom 中 copy/paste 下面的代码;这仅在 Eclipse 中有效,否则将被忽略。请注意,对于其他插件,您也可能会遇到相同的错误,因此您需要 repeat/adapt 处理您可能遇到的任何类似错误。

    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-compiler-plugin</artifactId>
                                    <versionRange>[0.0.0,)</versionRange>
                                    <goals>
                                        <goal>testCompile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>