diff --git a/.gitignore b/.gitignore
index 22e2e5898af3c..22b6684370c00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,7 +30,10 @@ plugins/transport/thrift/build
.idea/modules/plugin-river-rabbitmq.iml
.idea/projectCodeStyle.xml
-
+*~
+nbactions.xml
+nb-configuration.xml
+target/
## eclipse ignores (use 'gradle eclipse' to build eclipse projects)
.project
diff --git a/modules/elasticsearch/pom.xml b/modules/elasticsearch/pom.xml
new file mode 100644
index 0000000000000..4f91c775c3519
--- /dev/null
+++ b/modules/elasticsearch/pom.xml
@@ -0,0 +1,173 @@
+
+
+ 4.0.0
+ org.elasticsearch
+ elasticsearch
+ 0.19.0-SNAPSHOT
+
+
+ org.hyperic
+ sigar
+ 1.6.4.129
+
+
+ org.elasticsearch
+ jarjar
+ 0.19.0-SNAPSHOT
+
+
+ org.apache.lucene
+ lucene-core
+ 3.4.0
+ compile
+
+
+ log4j
+ log4j
+ 1.2.16
+ compile
+
+
+ jline
+ jline
+ 0.9.94
+ compile
+
+
+ org.slf4j
+ slf4j-api
+ 1.5.11
+ compile
+
+
+ org.hamcrest
+ hamcrest-core
+ 1.3.RC2
+ test
+
+
+ org.apache.lucene
+ lucene-analyzers
+ 3.4.0
+ compile
+
+
+ org.hamcrest
+ hamcrest-library
+ 1.3.RC2
+ test
+
+
+ org.apache.lucene
+ lucene-memory
+ 3.4.0
+ compile
+
+
+ org.beanshell
+ bsh
+ 2.0b4
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.5.11
+ compile
+
+
+ org.elasticsearch
+ test-testng
+ 0.19.0-SNAPSHOT
+ test
+
+
+ org.apache.lucene
+ lucene-queries
+ 3.4.0
+ compile
+
+
+ com.beust
+ jcommander
+ 1.5
+ test
+
+
+ org.apache.lucene
+ lucene-highlighter
+ 3.4.0
+ compile
+
+
+ net.java.dev.jna
+ jna
+ 3.2.7
+ compile
+
+
+ org.testng
+ testng
+ 6.1.1
+ test
+
+
+
+
+ JBOSS
+ JBOSS
+ https://repository.jboss.org/nexus/content/groups/public
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.10
+
+ false
+
+ **/*Tests.java
+
+
+
+
+
+
+ ${project.basedir}/src/main/java
+
+ **/*.java
+
+
+ **/**
+
+
+
+
+
+ ${project.basedir}/src/test/java
+
+ **/*.java
+
+
+ **/**
+
+
+
+
+
+ UTF-8
+
+
diff --git a/modules/test/integration/build.gradle b/modules/test/integration/build.gradle
index a7fc866de4d03..24e7ece1a732f 100644
--- a/modules/test/integration/build.gradle
+++ b/modules/test/integration/build.gradle
@@ -1,6 +1,7 @@
dependsOn(':elasticsearch')
apply plugin: 'java'
+apply plugin: 'maven'
apply plugin: 'eclipse'
archivesBaseName = "$rootProject.archivesBaseName-$project.archivesBaseName"
diff --git a/modules/test/integration/pom.xml b/modules/test/integration/pom.xml
new file mode 100644
index 0000000000000..ea32c5d9c107c
--- /dev/null
+++ b/modules/test/integration/pom.xml
@@ -0,0 +1,65 @@
+
+
+ 4.0.0
+ org.elasticsearch
+ test-integration
+ 0.19.0-SNAPSHOT
+
+
+ org.elasticsearch
+ elasticsearch
+ 0.19.0-SNAPSHOT
+ compile
+
+
+ org.hamcrest
+ hamcrest-library
+ 1.3.RC2
+ test
+
+
+ org.elasticsearch
+ test-testng
+ 0.19.0-SNAPSHOT
+ test
+
+
+ org.beanshell
+ bsh
+ 2.0b4
+ test
+
+
+ com.beust
+ jcommander
+ 1.5
+ test
+
+
+ org.testng
+ testng
+ 6.1.1
+ test
+
+
+ org.hamcrest
+ hamcrest-core
+ 1.3.RC2
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+
+
diff --git a/modules/test/testng/build.gradle b/modules/test/testng/build.gradle
index 87b0cc8e1eba6..de98aedf5efb9 100644
--- a/modules/test/testng/build.gradle
+++ b/modules/test/testng/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'java'
+apply plugin: 'maven'
apply plugin: 'eclipse'
archivesBaseName = "$rootProject.archivesBaseName-$project.archivesBaseName"
diff --git a/modules/test/testng/pom.xml b/modules/test/testng/pom.xml
new file mode 100644
index 0000000000000..6c3e370f22dc4
--- /dev/null
+++ b/modules/test/testng/pom.xml
@@ -0,0 +1,59 @@
+
+
+ 4.0.0
+ org.elasticsearch
+ test-testng
+ 0.19.0-SNAPSHOT
+
+
+ org.hamcrest
+ hamcrest-library
+ 1.3.RC2
+ test
+
+
+ org.beanshell
+ bsh
+ 2.0b4
+ test
+
+
+ log4j
+ log4j
+ 1.2.16
+ compile
+
+
+ com.beust
+ jcommander
+ 1.5
+ test
+
+
+ org.testng
+ testng
+ 6.1.1
+ compile
+
+
+ org.hamcrest
+ hamcrest-core
+ 1.3.RC2
+ test
+
+
+
+
+
+org.apache.maven.plugins
+maven-compiler-plugin
+2.3.2
+
+1.6
+1.6
+
+
+
+
+
diff --git a/pkg/mavenize.sh b/pkg/mavenize.sh
new file mode 100755
index 0000000000000..213bd3c540fa2
--- /dev/null
+++ b/pkg/mavenize.sh
@@ -0,0 +1,78 @@
+V=0.19.0-SNAPSHOT
+cd ../modules/
+
+# 1. add to all build.gradle files: elasticsearch, jarjar, test/testng, test/integration
+# apply plugin: 'maven'
+
+# 2. generate pom-default.xml
+# cd jarjar/; ../../gradlew clean install; cd ..
+# cd test/testng/; ../../../gradlew clean install; cd ../..
+# now implicitely call elasticsearch
+# cd test/integration/; ../../../gradlew clean install; cd ../..
+
+# use gradle created pom
+cp ./elasticsearch/build/poms/pom-default.xml ./elasticsearch/pom.xml
+
+# add hyperic dep (which is not present in the gradle deps?)
+sed -i 's//\n\norg.hyperic<\/groupId>\nsigar<\/artifactId>\n1.6.4.129<\/version>\n<\/dependency>/g' ./elasticsearch/pom.xml
+
+# add jarjar dep (which is generated from subproject)
+sed -i 's//\n\norg.elasticsearch<\/groupId>\njarjar<\/artifactId>\n<\/dependency>/g' ./elasticsearch/pom.xml
+
+# add jboss repo for hyperic
+sed -i 's/<\/dependencies>/<\/dependencies>\n\n\nJBOSS<\/name>\nJBOSS<\/id>\nhttps:\/\/repository.jboss.org\/nexus\/content\/groups\/public<\/url>\n<\/repository>\n<\/repositories>/g' ./elasticsearch/pom.xml
+
+# TODO include test files ending on *Tests too
+#
+#org.apache.maven.plugins
+#maven-surefire-plugin
+#2.10
+#
+#
+# test
+#
+# test
+#
+#
+# false
+#
+# **/*Tests.java
+#
+#
+#
+#
+#
+
+# use gradle created poms also for subprojects
+cp ./test/integration/build/poms/pom-default.xml ./test/integration/pom.xml
+cp ./test/testng/build/poms/pom-default.xml ./test/testng/pom.xml
+
+# apply some renaming
+sed -i 's/elasticsearch-test-integration/test-integration/g' ./test/integration/pom.xml
+sed -i 's/elasticsearch-test-testng/test-testng/g' ./test/testng/pom.xml
+
+# force 1.6 compiler
+for pomi in ./test/testng/pom.xml ./test/integration/pom.xml ./elasticsearch/pom.xml
+do
+ sed -i 's/<\/dependencies>/<\/dependencies>\n\n\n\norg.apache.maven.plugins<\/groupId>\nmaven-compiler-plugin<\/artifactId>\n2.3.2<\/version>\n\n1.6<\/source>\n1.6<\/target>\n<\/configuration>\n<\/plugin>\n<\/plugins>\n<\/build>/g' $pomi
+done
+
+# install jarjar
+echo "mvn install:install-file -DgroupId=org.elasticsearch -DartifactId=jarjar -Dpackaging=jar -Dversion="$V" -Dfile=build/libs/jarjar-"$V".jar -DgeneratePom=true" > ./jarjar/install.sh
+chmod +x ./jarjar/install.sh
+cd ./jarjar/
+./install.sh
+rm install.sh
+cd ..
+
+# now install some jars (via normal maven procedure) for elasticsearch project
+cd test/testng; mvn clean install; cd ../..
+cd test/integration; mvn clean install; cd ../..
+
+# move some configs around to match maven structure
+mkdir -p ./elasticsearch/src/main/resources/org/elasticsearch/index/mapper/
+mkdir -p ./elasticsearch/src/main/resources/config
+mv ./elasticsearch/src/main/java/org/elasticsearch/index/mapper/default-mapping.json ./elasticsearch/src/main/resources/org/elasticsearch/index/mapper/default-mapping.json
+mv ./elasticsearch/src/main/java/config/names.txt ./elasticsearch/src/main/resources/config/names.txt
+rm -rf ./elasticsearch/src/main/java/config/
+