maven:com.example.speech的不可分解的父pom:speech-google-cloud-sampl



我尝试使用语音使用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:execution:default-testCompile,phase:stase:test-compile(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>
` 

您的标题,帖子的内容显示了两个不同的问题。我将回应您帖子内容所描述的内容。

您的问题是经典的日食整合问题;也就是说,您需要指示Eclipse如何使用POM参考的各种插件(您可能想忽略它们(。

因此,在您的情况下,您需要在POM中复制/粘贴以下代码;这仅在日食中有效,否则将被忽略。请注意,您也可能会因其他插件而遇到相同的错误,因此您需要重复/适应可能遇到的任何类似错误的过程。

    <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>

最新更新