在IntelliJ和命令行中,Maven构建失败

时间:2017-07-11 02:41:10

标签: java intellij-idea maven-3

我已经搜索了高低,找到了解决方案,我很难过。

我正在尝试使用 google-cloud-dataflow-java-sdk-all 原型构建并继续在IntelliJ中获取相同的错误,并在命令中使用mvn install使用POM线。从命令行使用mvn archetype:generate ...也会得到相同的错误。

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli)
on project standalone-pom: The defined artifact is not an archetype -> [Help 1]

希望别人看到这个。

的pom.xml:

<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>
 
  <parent>
    <groupId>com.google.cloud.dataflow</groupId>
    <artifactId>google-cloud-dataflow-java-sdk-parent</artifactId>
    <version>2.0.0</version>
  </parent>
 
  <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
  <name>Google Cloud Dataflow SDK for Java - All</name>
  <description>Google Cloud Dataflow SDK for Java is a distribution of Apache
      Beam designed to simplify usage of Apache Beam on Google Cloud Dataflow
      service. This artifact includes entire Dataflow Java SDK.</description>
 
  <packaging>jar</packaging>
 
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>
 
  <dependencies>
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-core</artifactId>
    </dependency>
 
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-io-google-cloud-platform</artifactId>
    </dependency>
 
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-runners-direct-java</artifactId>
    </dependency>
 
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-runners-google-cloud-dataflow-java</artifactId>
    </dependency>
  </dependencies>
</project>

mvn generate:archetype命令:

mvn archetype:generate \
-DarchetypeArtifactId=google-cloud-dataflow-java-sdk-all \
-DarchetypeGroupId=com.google.cloud.dataflow \
-DarchetypeVersion=2.0.0 \
-DgroupId=com.rgault.google \
-DartifactId=dataflow \
-DinteractiveMode=false \
-Dpackage=com.rgault.google \
-Dversion=0.1

1 个答案:

答案 0 :(得分:2)

你正试图使用​​一个实际上不是一个的原型,而是一个all-in-one dependency bundle

  

Google Cloud Dataflow SDK For Java All»2.0.0   

Google Cloud Dataflow SDK for Java是Apache Beam的一个发行版,旨在简化Google Cloud Dataflow服务上Apache Beam的使用。此工件包括整个Dataflow Java SDK。


根据these docs,正确的原型ID为google-cloud-dataflow-java-archetypes-examples

  

创建一个包含Cloud Dataflow SDK for Java和示例的Maven项目

     
      
  1. 使用Maven Archetype插件创建包含Cloud Dataflow SDK for Java的Maven项目。在shell或终端中运行mvn archetype:generate命令,如下所示:

      

    JAVA:SDK 1.X

        mvn archetype:generate \
        -DarchetypeArtifactId=google-cloud-dataflow-java-archetypes-examples \
        -DarchetypeGroupId=com.google.cloud.dataflow \
        -DarchetypeVersion=1.9.0 \
        -DgroupId=com.example \
        -DartifactId=first-dataflow \
        -Dversion="0.1" \
        -DinteractiveMode=false \
        -Dpackage=com.example
         

    JAVA:SDK 2.X

        mvn archetype:generate \
        -DarchetypeArtifactId=google-cloud-dataflow-java-archetypes-examples \
        -DarchetypeGroupId=com.google.cloud.dataflow \
        -DarchetypeVersion=2.0.0 \
        -DgroupId=com.example \
        -DartifactId=first-dataflow \
        -Dversion="0.1" \
        -DinteractiveMode=false \
        -Dpackage=com.example
  2.