1
votes

I tried using speech to text using google speech client from github:
https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/speech/cloud-client

In pom.xml it shows the following issue:
Description Resource Path Location Type Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /speech-google-cloud-samples line 23 Maven Project Build Lifecycle Mapping Problem

How do i fix this problem? Sorry for the long code..

<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>
` 
1
The <relativePath>../..</relativePath> is simply wrong...cause it does not exist...which means the example is broken...khmarbaise
Hi when i remove relative path it shows an error.. because it is a property of parent tag. what should i do in such a case?Radhika

1 Answers

0
votes

Your title, and the content of your post show two different problems. I'm going to respond to the one described by the content of your post.

Your problem is a classic eclipse-integration problem; that is, you need to instruct eclipse what to do with various plugins that your pom references (you probably want to ignore them).

So in your situation, you need to copy/paste the below code in your pom; this will have effect only in Eclipse, and be ignored otherwise. Please note that you are likely to get the same error for other plugins as well, so you need to repeat/adapt the process for any similar errors you might get.

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