无法执行目标org.apache.maven.plugins:maven-antrun-plugin

时间:2015-10-06 07:28:41

标签: java eclipse maven

为Adhar(UIDAI)设置开发环境时记录here

我收到以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:
run (generate-sources) on project uidai-auth-proto-model: An Ant BuildException

根据导航到从此处here下载的源代码后的文档,我们需要在命令行中运行mvn eclipse:eclipse。成功构建后,我们可以将这些项目导入eclipse。

成功构建消息 enter image description here

但由于某种原因,我无法建造 enter image description here

我的maven,ant和java配置 enter image description here

UID Protobuf模型文件

UID-Protobuf的Git存储库是here

3 个答案:

答案 0 :(得分:5)

问题是maven-antrun-plugin没有得到构建(执行)。在uidai-auth-proto-model / pom.xml中包含pluginManagement标记之间的插件,如下所示:

<pluginManagement>
  <plugins>
    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <version>1.3</version>
      <executions>
        <execution>
          <id>generate-sources</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>run</goal>
          </goals>
          <configuration>
            <tasks>
              <exec executable="protoc">
                <arg value="--java_out=src/main/java" />
                <arg value="--proto_path=src/main/proto/auth/" />
                <arg value="src/main/proto/auth/auth.proto" />
              </exec>
              <exec executable="protoc">
                <arg value="--java_out=src/main/java" />
                <arg value="--proto_path=src/main/proto/bfd/" />
                <arg value="src/main/proto/bfd/bfd.proto" />
              </exec>
            </tasks>
            <sourceRoot>src/main/java</sourceRoot>
          </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.2-beta-5</version>
    </plugin>
    <plugin>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>2.8</version>
    </plugin>
    <plugin>
      <artifactId>maven-release-plugin</artifactId>
      <version>2.3.2</version>
    </plugin>
    <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.2</version>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
          </manifest>
        </archive>
        <includes>
          <include>packaged/**/*</include>
          <include>in/**/*</include>
        </includes>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.0.2</version>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

答案 1 :(得分:1)

您需要在protoc或项目根目录中拥有PATH(Protobuf编译器)。确保使用与POM中声明的protoc工件相同的protobuf-java版本。

答案 2 :(得分:0)

另外,在uidai-auth-xsd-model / pom.xml中也一样,如下所示:

<pluginManagement>
  <plugins>
    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <version>1.3</version>
    </plugin>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.2-beta-5</version>
    </plugin>
    <plugin>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>2.8</version>
    </plugin>
    <plugin>
      <artifactId>maven-release-plugin</artifactId>
      <version>2.3.2</version>
    </plugin>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>jaxb2-maven-plugin</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>xjc</goal>
          </goals>
          <configuration>
            <outputDirectory>C:\Users\kumar.rahul@fin1.com\Downloads\uidai-auth-client-1.6-src\uidai-auth-xsd-model/src/main/java</outputDirectory>
            <extension>true</extension>
          </configuration>
        </execution>
      </executions>
      <configuration>
        <outputDirectory>C:\Users\kumar.rahul@fin1.com\Downloads\uidai-auth-client-1.6-src\uidai-auth-xsd-model/src/main/java</outputDirectory>
        <extension>true</extension>
      </configuration>
    </plugin>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>