当前位置: 首页 > 知识库问答 >
问题:

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

陶征
2023-03-14

我尝试使用GitHub中的google speech client将语音转换为文本:
https://github.com/GoogleLoudPlatform/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 line 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>
` 

共有1个答案

沈弘文
2023-03-14

你的标题和你帖子的内容显示了两个不同的问题。我要回应你帖子内容所描述的那个。

您的问题是典型的Eclipse集成问题;也就是说,您需要指示eclipse如何处理pom引用的各种插件(您可能希望忽略它们)。

因此,在您的情况下,您需要在您的POM中复制/粘贴以下代码;这只在Eclipse中有效,否则将被忽略。请注意,其他插件也可能会出现相同的错误,因此您需要重复/调整该过程以应对可能出现的任何类似错误。

    <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>
 类似资料:
  • 下面是我的pom.xml文件:

  • 我是Spring的新手,我正在尝试创建一个Spring入门项目。然而,我的pom.xml.有一个错误。 行<代码> 我看到了这些链接,但并没有解决我的问题。 项目生成错误:不可解析的父POM。无法转移组织。springframework。启动:spring启动程序父级 Maven:不可解析的父POM

  • 我试图添加依赖到我的maven项目。我想添加Spring引导配置。但是它在父标签中给出了这个错误, 项目构建错误: io.javabrains.springbootquickstart的不可解析父POM: Court-api: 0.0.1-SNAPSHOT:未能找到 org.springframework-boot: spall-boot-starter-父: pom: 1.4.2。https:/

  • 我为我的项目创建了一个gitlab-ci。 当我运行管道时,我面临以下错误: [致命][projectName]的父POM不可解析-父:0.0.1-快照:无法将项目org.springframework.boot:spring-boot-starter-父:POM:2.4.0从/到[serverName]:[serverName]/org/springframework/boot/spring-b

  • null 项目生成错误:无法解析得父POM无法传输org.springframework.boot:spring-boot-starter-parent:POM:2.0.0.来自http://repo.maven.apache.org/maven2/得版本已缓存在本地存储库中,在经过artie得更新间隔或强制更新之前,将不会重新尝试解析.原始错误:无法传输项目org.springframework