HADOOP-9117. replace protoc ant plugin exec with a maven plugin. (tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1446021 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca12c99c79
commit
1709c222d9
|
@ -16,6 +16,8 @@ Release 2.0.4-beta - UNRELEASED
|
|||
HADOOP-8924. Add maven plugin alternative to shell script to save
|
||||
package-info.java. (Chris Nauroth via suresh)
|
||||
|
||||
HADOOP-9117. replace protoc ant plugin exec with a maven plugin. (tucu)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -298,6 +298,10 @@
|
|||
<!-- protobuf generated code -->
|
||||
<Class name="~org\.apache\.hadoop\.security\.proto\.SecurityProtos.*"/>
|
||||
</Match>
|
||||
<Match>
|
||||
<!-- protobuf generated code -->
|
||||
<Class name="~org\.apache\.hadoop\.ipc\.protobuf\.TestProtos.*"/>
|
||||
</Match>
|
||||
|
||||
<!--
|
||||
Manually checked, misses child thread manually syncing on parent's intrinsic lock.
|
||||
|
|
|
@ -293,6 +293,51 @@
|
|||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<imports>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>HAServiceProtocol.proto</include>
|
||||
<include>IpcConnectionContext.proto</include>
|
||||
<include>ProtocolInfo.proto</include>
|
||||
<include>RpcPayloadHeader.proto</include>
|
||||
<include>ZKFCProtocol.proto</include>
|
||||
<include>hadoop_rpc.proto</include>
|
||||
<include>Security.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-test-protoc</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<imports>
|
||||
<param>${basedir}/src/test/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/test/proto</directory>
|
||||
<includes>
|
||||
<include>test.proto</include>
|
||||
<include>test_rpc_service.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-test-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -326,14 +371,13 @@
|
|||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<id>create-recordcc-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/java" />
|
||||
<mkdir dir="target/generated-test-sources/java" />
|
||||
</target>
|
||||
</configuration>
|
||||
|
@ -394,67 +438,12 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile-proto</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/HAServiceProtocol.proto</argument>
|
||||
<argument>src/main/proto/IpcConnectionContext.proto</argument>
|
||||
<argument>src/main/proto/ProtocolInfo.proto</argument>
|
||||
<argument>src/main/proto/RpcPayloadHeader.proto</argument>
|
||||
<argument>src/main/proto/ZKFCProtocol.proto</argument>
|
||||
<argument>src/main/proto/hadoop_rpc.proto</argument>
|
||||
<argument>src/main/proto/Security.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-test-proto</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-Isrc/test/proto/</argument>
|
||||
<argument>--java_out=target/generated-test-sources/java</argument>
|
||||
<argument>src/test/proto/test.proto</argument>
|
||||
<argument>src/test/proto/test_rpc_service.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/generated-sources/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-test-source</id>
|
||||
<id>add-recordcc-test-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
|
|
|
@ -204,7 +204,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</goals>
|
||||
<configuration>
|
||||
<compile>false</compile>
|
||||
<workingDirectory>${project.build.directory}/generated-src/main/jsp</workingDirectory>
|
||||
<workingDirectory>${project.build.directory}/generated-sources/java</workingDirectory>
|
||||
<webFragmentFile>${project.build.directory}/hdfs-jsp-servlet-definitions.xml</webFragmentFile>
|
||||
<packageName>org.apache.hadoop.hdfs.server.namenode</packageName>
|
||||
<sources>
|
||||
|
@ -223,7 +223,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</goals>
|
||||
<configuration>
|
||||
<compile>false</compile>
|
||||
<workingDirectory>${project.build.directory}/generated-src/main/jsp</workingDirectory>
|
||||
<workingDirectory>${project.build.directory}/generated-sources/java</workingDirectory>
|
||||
<webFragmentFile>${project.build.directory}/secondary-jsp-servlet-definitions.xml</webFragmentFile>
|
||||
<packageName>org.apache.hadoop.hdfs.server.namenode</packageName>
|
||||
<sources>
|
||||
|
@ -242,7 +242,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</goals>
|
||||
<configuration>
|
||||
<compile>false</compile>
|
||||
<workingDirectory>${project.build.directory}/generated-src/main/jsp</workingDirectory>
|
||||
<workingDirectory>${project.build.directory}/generated-sources/java</workingDirectory>
|
||||
<webFragmentFile>${project.build.directory}/journal-jsp-servlet-definitions.xml</webFragmentFile>
|
||||
<packageName>org.apache.hadoop.hdfs.server.journalservice</packageName>
|
||||
<sources>
|
||||
|
@ -261,7 +261,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</goals>
|
||||
<configuration>
|
||||
<compile>false</compile>
|
||||
<workingDirectory>${project.build.directory}/generated-src/main/jsp</workingDirectory>
|
||||
<workingDirectory>${project.build.directory}/generated-sources/java</workingDirectory>
|
||||
<webFragmentFile>${project.build.directory}/datanode-jsp-servlet-definitions.xml</webFragmentFile>
|
||||
<packageName>org.apache.hadoop.hdfs.server.datanode</packageName>
|
||||
<sources>
|
||||
|
@ -296,7 +296,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<id>add-jsp-generated-sources-directory</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
|
@ -304,7 +304,6 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/generated-sources/java</source>
|
||||
<source>${project.build.directory}/generated-src/main/jsp</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -318,14 +317,14 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<id>create-jsp-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/java" />
|
||||
<mkdir dir="${project.build.directory}/generated-sources/java" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
@ -403,80 +402,96 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile-proto</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/hdfs.proto</argument>
|
||||
<argument>src/main/proto/GetUserMappingsProtocol.proto</argument>
|
||||
<argument>src/main/proto/HAZKInfo.proto</argument>
|
||||
<argument>src/main/proto/InterDatanodeProtocol.proto</argument>
|
||||
<argument>src/main/proto/JournalProtocol.proto</argument>
|
||||
<argument>src/main/proto/RefreshAuthorizationPolicyProtocol.proto</argument>
|
||||
<argument>src/main/proto/RefreshUserMappingsProtocol.proto</argument>
|
||||
<argument>src/main/proto/datatransfer.proto</argument>
|
||||
</arguments>
|
||||
<imports>
|
||||
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>GetUserMappingsProtocol.proto</include>
|
||||
<include>HAZKInfo.proto</include>
|
||||
<include>InterDatanodeProtocol.proto</include>
|
||||
<include>JournalProtocol.proto</include>
|
||||
<include>RefreshAuthorizationPolicyProtocol.proto</include>
|
||||
<include>RefreshUserMappingsProtocol.proto</include>
|
||||
<include>datatransfer.proto</include>
|
||||
<include>hdfs.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-proto-datanode</id>
|
||||
<id>compile-protoc-datanode</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/ClientDatanodeProtocol.proto</argument>
|
||||
<argument>src/main/proto/DatanodeProtocol.proto</argument>
|
||||
</arguments>
|
||||
<imports>
|
||||
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>ClientDatanodeProtocol.proto</include>
|
||||
<include>DatanodeProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-proto-namenode</id>
|
||||
<id>compile-protoc-namenode</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/ClientNamenodeProtocol.proto</argument>
|
||||
<argument>src/main/proto/NamenodeProtocol.proto</argument>
|
||||
</arguments>
|
||||
<imports>
|
||||
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>ClientNamenodeProtocol.proto</include>
|
||||
<include>NamenodeProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-proto-qjournal</id>
|
||||
<id>compile-protoc-qjournal</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/QJournalProtocol.proto</argument>
|
||||
</arguments>
|
||||
<imports>
|
||||
<param>${basedir}/../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>QJournalProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -92,63 +92,28 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${project.build.directory}/generated-sources/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/java" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile-proto</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>-I../../main/proto</argument>
|
||||
<argument>--java_out=target/generated-sources/java</argument>
|
||||
<argument>src/main/proto/bkjournal.proto</argument>
|
||||
</arguments>
|
||||
<imports>
|
||||
<param>${basedir}/../../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../../../../../hadoop-hdfs-project/hadoop-hdfs/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>bkjournal.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -54,63 +54,30 @@
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/proto" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-I../../../hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/proto</argument>
|
||||
<argument>src/main/proto/mr_protos.proto</argument>
|
||||
<argument>src/main/proto/mr_service_protos.proto</argument>
|
||||
<argument>src/main/proto/MRClientProtocol.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/proto</source>
|
||||
</sources>
|
||||
<imports>
|
||||
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../../../hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>mr_protos.proto</include>
|
||||
<include>mr_service_protos.proto</include>
|
||||
<include>MRClientProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2012 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.maven.plugin.protoc;
|
||||
|
||||
import org.apache.hadoop.maven.plugin.util.Exec;
|
||||
import org.apache.hadoop.maven.plugin.util.FileSetUtils;
|
||||
import org.apache.maven.model.FileSet;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mojo(name="protoc", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
|
||||
public class ProtocMojo extends AbstractMojo {
|
||||
|
||||
@Parameter(defaultValue="${project}")
|
||||
private MavenProject project;
|
||||
|
||||
@Parameter
|
||||
private List<File> imports;
|
||||
|
||||
@Parameter(defaultValue="${project.build.directory}/generated-sources/java")
|
||||
private File output;
|
||||
|
||||
@Parameter(required=true)
|
||||
private FileSet source;
|
||||
|
||||
@Parameter(defaultValue="protoc")
|
||||
private String protocCommand;
|
||||
|
||||
|
||||
public void execute() throws MojoExecutionException {
|
||||
try {
|
||||
if (!output.mkdirs()) {
|
||||
if (!output.exists()) {
|
||||
throw new MojoExecutionException("Could not create directory: " +
|
||||
output);
|
||||
}
|
||||
}
|
||||
List<String> command = new ArrayList<String>();
|
||||
command.add(protocCommand);
|
||||
command.add("--java_out=" + output.getCanonicalPath());
|
||||
if (imports != null) {
|
||||
for (File i : imports) {
|
||||
command.add("-I" + i.getCanonicalPath());
|
||||
}
|
||||
}
|
||||
for (File f : FileSetUtils.convertFileSetToFiles(source)) {
|
||||
command.add(f.getCanonicalPath());
|
||||
}
|
||||
Exec exec = new Exec(this);
|
||||
List<String> out = new ArrayList<String>();
|
||||
if (exec.run(command, out) != 0) {
|
||||
getLog().error("protoc compiler error");
|
||||
for (String s : out) {
|
||||
getLog().error(s);
|
||||
}
|
||||
throw new MojoExecutionException("protoc failure");
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
throw new MojoExecutionException(ex.toString(), ex);
|
||||
}
|
||||
project.addCompileSourceRoot(output.getAbsolutePath());
|
||||
}
|
||||
|
||||
}
|
|
@ -35,66 +35,33 @@
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/proto" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/proto</argument>
|
||||
<argument>src/main/proto/yarn_protos.proto</argument>
|
||||
<argument>src/main/proto/yarn_service_protos.proto</argument>
|
||||
<argument>src/main/proto/AM_RM_protocol.proto</argument>
|
||||
<argument>src/main/proto/client_RM_protocol.proto</argument>
|
||||
<argument>src/main/proto/container_manager.proto</argument>
|
||||
<argument>src/main/proto/yarn_server_resourcemanager_service_protos.proto</argument>
|
||||
<argument>src/main/proto/RMAdminProtocol.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/proto</source>
|
||||
</sources>
|
||||
<imports>
|
||||
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>yarn_protos.proto</include>
|
||||
<include>yarn_service_protos.proto</include>
|
||||
<include>AM_RM_protocol.proto</include>
|
||||
<include>client_RM_protocol.proto</include>
|
||||
<include>container_manager.proto</include>
|
||||
<include>yarn_server_resourcemanager_service_protos.proto</include>
|
||||
<include>RMAdminProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -107,6 +107,27 @@
|
|||
</source>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<imports>
|
||||
<param>${basedir}/../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../hadoop-yarn-api/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>yarnprototunnelrpc.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -124,18 +145,6 @@
|
|||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/proto" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<phase>pre-site</phase>
|
||||
<goals>
|
||||
|
@ -151,49 +160,6 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-I../hadoop-yarn-api/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/proto</argument>
|
||||
<argument>src/main/proto/yarnprototunnelrpc.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/proto</source>
|
||||
<source>target/generated-sources/version</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -48,18 +48,6 @@
|
|||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/proto" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<phase>pre-site</phase>
|
||||
<goals>
|
||||
|
@ -75,45 +63,31 @@
|
|||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-I../../hadoop-yarn-api/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/proto</argument>
|
||||
<argument>src/main/proto/yarn_server_common_protos.proto</argument>
|
||||
<argument>src/main/proto/yarn_server_common_service_protos.proto</argument>
|
||||
<argument>src/main/proto/ResourceTracker.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/proto</source>
|
||||
</sources>
|
||||
<imports>
|
||||
<param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../../hadoop-yarn-api/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>yarn_server_common_protos.proto</include>
|
||||
<include>yarn_server_common_service_protos.proto</include>
|
||||
<include>yarn_server_common_service_protos.proto</include>
|
||||
<include>ResourceTracker.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -151,69 +151,29 @@
|
|||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-maven-plugins</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-protobuf-generated-sources-directory</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<mkdir dir="target/generated-sources/proto" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<id>compile-protoc</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate-sources</id>
|
||||
<phase>generate-sources</phase>
|
||||
<configuration>
|
||||
<executable>protoc</executable>
|
||||
<arguments>
|
||||
<argument>-I../../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
|
||||
<argument>-I../../hadoop-yarn-api/src/main/proto/</argument>
|
||||
<argument>-Isrc/main/proto/</argument>
|
||||
<argument>--java_out=target/generated-sources/proto</argument>
|
||||
<argument>src/main/proto/yarn_server_nodemanager_service_protos.proto</argument>
|
||||
<argument>src/main/proto/LocalizationProtocol.proto</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
<goal>protoc</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>target/generated-sources/proto</source>
|
||||
</sources>
|
||||
<imports>
|
||||
<param>${basedir}/../../../../hadoop-common-project/hadoop-common/src/main/proto</param>
|
||||
<param>${basedir}/../../hadoop-yarn-api/src/main/proto</param>
|
||||
<param>${basedir}/src/main/proto</param>
|
||||
</imports>
|
||||
<source>
|
||||
<directory>${basedir}/src/main/proto</directory>
|
||||
<includes>
|
||||
<include>yarn_server_nodemanager_service_protos.proto</include>
|
||||
<include>LocalizationProtocol.proto</include>
|
||||
</includes>
|
||||
</source>
|
||||
<output>${project.build.directory}/generated-sources/java</output>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
Loading…
Reference in New Issue