diff --git a/docs/pom.xml b/docs/pom.xml
index c96a5827..535e1893 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -32,6 +32,12 @@ limitations under the License.
Sqoop Documentation
+
+
+ org.apache.sqoop
+ sqoop-server
+
+
org.testng
testng
@@ -47,34 +53,66 @@ limitations under the License.
+
- org.apache.maven.plugins
- maven-site-plugin
-
-
+ org.codehaus.mojo
+ exec-maven-plugin
+
+ org.apache.sqoop.docs.generator.DocPreprocessor
+
+ ${project.basedir}/src/site/sphinx/
+ ${project.build.directory}/docs-preprocessor/
+
+
- packaging-documentation
+ generate-docs-package
package
- site
+ java
+
+
+
+ generate-docs-site
+ site
+
+ java
-
-
-
-
-
+
+
org.tomdz.maven
sphinx-maven-plugin
1.0.3
+
true
+ ${project.build.directory}/docs-preprocessor/
+
+
+ sphinx-package
+ package
+
+ generate
+
+
+
+ sphinx-site
+ site
+
+ generate
+
+
+
+
+
+
+
org.apache.maven.plugins
diff --git a/docs/src/main/java/org/apache/sqoop/docs/generator/DocPreprocessor.java b/docs/src/main/java/org/apache/sqoop/docs/generator/DocPreprocessor.java
new file mode 100644
index 00000000..5ea3aa06
--- /dev/null
+++ b/docs/src/main/java/org/apache/sqoop/docs/generator/DocPreprocessor.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sqoop.docs.generator;
+
+import org.apache.log4j.Logger;
+import org.apache.sqoop.docs.generator.plugins.AbstractPlugin;
+import org.apache.sqoop.docs.generator.plugins.CopySourceToDestination;
+import org.apache.sqoop.utils.ClassUtils;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Documentation preprocessing that generates some of the RST files dynamically.
+ */
+public class DocPreprocessor {
+
+ private static final Logger LOG = Logger.getLogger(DocPreprocessor.class);
+
+ private static List> plugins;
+ static {
+ plugins = new LinkedList<>();
+ plugins.add(CopySourceToDestination.class);
+ }
+
+ public static void main(String []args) {
+ LOG.info("Documentation preprocessor started");
+
+ // Parameter handling
+ if(args.length != 2) {
+ throw new RuntimeException("Expected two arguments - source and destination - but " + args.length + " given.");
+ }
+ String source = args[0];
+ String destination = args[1];
+ LOG.info("Source directory: " + source);
+ LOG.info("Destination directory: " + destination);
+
+ // Plugin execution
+ for(Class extends AbstractPlugin> pluginClass : plugins) {
+ LOG.info("Running plugin " + pluginClass.getCanonicalName());
+
+ AbstractPlugin plugin = (AbstractPlugin) ClassUtils.instantiate(pluginClass);
+ plugin.setSource(source);
+ plugin.setDestination(destination);
+
+ plugin.run();
+ }
+
+ LOG.info("Documentation preprocessor finished");
+ }
+}
diff --git a/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/AbstractPlugin.java b/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/AbstractPlugin.java
new file mode 100644
index 00000000..6219b7a4
--- /dev/null
+++ b/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/AbstractPlugin.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sqoop.docs.generator.plugins;
+
+/**
+ * Abstract plugin class to abstract steps during docs pre-processing
+ */
+abstract public class AbstractPlugin {
+
+ /**
+ * Source directory
+ */
+ private String source;
+
+ /**
+ * Destination directory;
+ */
+ private String destination;
+
+ /**
+ * Do the plugin step.
+ *
+ * Throws RuntimeException aborting the build on error.
+ */
+ abstract public void run();
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setDestination(String destination) {
+ this.destination = destination;
+ }
+
+ public String getDestination() {
+ return destination;
+ }
+
+}
diff --git a/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/CopySourceToDestination.java b/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/CopySourceToDestination.java
new file mode 100644
index 00000000..2ef63726
--- /dev/null
+++ b/docs/src/main/java/org/apache/sqoop/docs/generator/plugins/CopySourceToDestination.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.sqoop.docs.generator.plugins;
+
+import org.apache.commons.io.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Copy Source files to destination directory preserving directory structure.
+ */
+public class CopySourceToDestination extends AbstractPlugin {
+ @Override
+ public void run() {
+ try {
+ FileUtils.copyDirectory(new File(getSource()), new File(getDestination()));
+ } catch (IOException e) {
+ throw new RuntimeException("Can't copy source artifacts to destination", e);
+ }
+ }
+}
diff --git a/docs/src/main/resources/log4j.properties b/docs/src/main/resources/log4j.properties
new file mode 100644
index 00000000..a6fad342
--- /dev/null
+++ b/docs/src/main/resources/log4j.properties
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=[DOC GEN] %-5p %c %x: %m%n
diff --git a/pom.xml b/pom.xml
index ba0a2437..87fa94fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -751,6 +751,11 @@ limitations under the License.
${maven.compile.target}
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.4.0
+
org.apache.rat
apache-rat-plugin