diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 7a898741fa..21eda1b32f 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -145,6 +145,8 @@ Trunk (unreleased changes)
HADOOP-7761. Improve the performance of raw comparisons. (todd)
+ HADOOP_7917. compilation of protobuf files fails in windows/cygwin. (tucu)
+
Release 0.23.1 - Unreleased
INCOMPATIBLE CHANGES
diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml
index f477d385a5..aa3548e666 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -296,17 +296,29 @@
-
- PROTO_DIR=${basedir}/src/main/proto
- ls $PROTO_DIR &> /dev/null
- if [ $? = 0 ]; then
- JAVA_DIR=${project.build.directory}/generated-sources/java
- mkdir -p $JAVA_DIR
- ls $PROTO_DIR/*.proto | xargs -n 1 protoc -I$PROTO_DIR --java_out=$JAVA_DIR
- fi
+
+ PROTO_DIR=src/main/proto
+ JAVA_DIR=target/generated-sources/java
+ which cygpath 2> /dev/null
+ if [ $? = 1 ]; then
+ IS_WIN=false
+ else
+ IS_WIN=true
+ WIN_PROTO_DIR=`cygpath --windows $PROTO_DIR`
+ WIN_JAVA_DIR=`cygpath --windows $JAVA_DIR`
+ fi
+ mkdir -p $JAVA_DIR 2> /dev/null
+ for PROTO_FILE in `ls $PROTO_DIR/*.proto 2> /dev/null`
+ do
+ if [ "$IS_WIN" = "true" ]; then
+ protoc -I$WIN_PROTO_DIR --java_out=$WIN_JAVA_DIR $PROTO_FILE
+ else
+ protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
+ fi
+ done
-
-
+
+
@@ -319,17 +331,29 @@
-
- PROTO_DIR=${basedir}/src/test/proto
- ls $PROTO_DIR &> /dev/null
- if [ $? = 0 ]; then
- JAVA_DIR=${project.build.directory}/generated-test-sources/java
- mkdir -p $JAVA_DIR
- ls $PROTO_DIR/*.proto | xargs -n 1 protoc -I$PROTO_DIR --java_out=$JAVA_DIR
- fi
+
+ PROTO_DIR=src/test/proto
+ JAVA_DIR=target/generated-test-sources/java
+ which cygpath 2> /dev/null
+ if [ $? = 1 ]; then
+ IS_WIN=false
+ else
+ IS_WIN=true
+ WIN_PROTO_DIR=`cygpath --windows $PROTO_DIR`
+ WIN_JAVA_DIR=`cygpath --windows $JAVA_DIR`
+ fi
+ mkdir -p $JAVA_DIR 2> /dev/null
+ for PROTO_FILE in `ls $PROTO_DIR/*.proto 2> /dev/null`
+ do
+ if [ "$IS_WIN" = "true" ]; then
+ protoc -I$WIN_PROTO_DIR --java_out=$WIN_JAVA_DIR $PROTO_FILE
+ else
+ protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
+ fi
+ done
-
-
+
+
diff --git a/hadoop-hdfs-project/hadoop-hdfs/pom.xml b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
index 25eaef2579..835b15a465 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/pom.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/pom.xml
@@ -224,17 +224,29 @@
-
- PROTO_DIR=${basedir}/src/main/proto
- ls $PROTO_DIR &> /dev/null
- if [ $? = 0 ]; then
- JAVA_DIR=${project.build.directory}/generated-sources/java
- mkdir -p $JAVA_DIR
- ls $PROTO_DIR/*.proto | xargs -n 1 protoc -I$PROTO_DIR --java_out=$JAVA_DIR
- fi
+
+ PROTO_DIR=src/main/proto
+ JAVA_DIR=target/generated-sources/java
+ which cygpath 2> /dev/null
+ if [ $? = 1 ]; then
+ IS_WIN=false
+ else
+ IS_WIN=true
+ WIN_PROTO_DIR=`cygpath --windows $PROTO_DIR`
+ WIN_JAVA_DIR=`cygpath --windows $JAVA_DIR`
+ fi
+ mkdir -p $JAVA_DIR 2> /dev/null
+ for PROTO_FILE in `ls $PROTO_DIR/*.proto 2> /dev/null`
+ do
+ if [ "$IS_WIN" = "true" ]; then
+ protoc -I$WIN_PROTO_DIR --java_out=$WIN_JAVA_DIR $PROTO_FILE
+ else
+ protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
+ fi
+ done
-
-
+
+