[FLINK-4813] [test-utils] Make the hadoop-minikdc dependency optional

With this change, any project using flink-test-utils which also requires
SecureTestEnvironment must add a dependency to hadoop-minikdc itself, e.g. in
pom.xml:

   ...
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-minikdc</artifactId>
       <version>${minikdc.version}</version>
       <scope>compile</scope>
     </dependency>
   ...
   </dependencies>
   ...

   <build>
     <plugins>
       <!--
         https://issues.apache.org/jira/browse/DIRSHARED-134
         Required to pull the Mini-KDC transitive dependency
       -->
       <plugin>
       <groupId>org.apache.felix</groupId>
       <artifactId>maven-bundle-plugin</artifactId>
       <version>3.0.1</version>
       <inherited>true</inherited>
       <extensions>true</extensions>
     </plugin>
   ...

This closes #3322


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/391efd35
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/391efd35
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/391efd35

Branch: refs/heads/master
Commit: 391efd35bffe3f5796cd655ae1598f102a2e8fb7
Parents: 1ceb7d8
Author: Nico Kruber <[email protected]>
Authored: Wed Feb 15 14:24:32 2017 +0100
Committer: Stephan Ewen <[email protected]>
Committed: Mon Feb 20 01:01:23 2017 +0100

----------------------------------------------------------------------
 .../flink-test-utils/pom.xml                    | 23 +++++++++++++
 .../flink/test/util/SecureTestEnvironment.java  | 34 ++++++++++++++++++--
 pom.xml                                         | 10 ------
 3 files changed, 55 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/391efd35/flink-test-utils-parent/flink-test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/flink-test-utils-parent/flink-test-utils/pom.xml 
b/flink-test-utils-parent/flink-test-utils/pom.xml
index b986056..069f1da 100644
--- a/flink-test-utils-parent/flink-test-utils/pom.xml
+++ b/flink-test-utils-parent/flink-test-utils/pom.xml
@@ -83,8 +83,31 @@ under the License.
                        <artifactId>hadoop-minikdc</artifactId>
                        <version>${minikdc.version}</version>
                        <scope>compile</scope>
+                       <!-- Since this requires the maven-bundle-plugin to be 
present,
+                       make it optional.
+                       The only class using this dependency is 
SecureTestEnvironment and if
+                       a project is using it, it must now add the 
hadoop-minikdc dependency
+                       on its own as well as include maven-bundle-plugin.
+                       -->
+                       <optional>true</optional>
                </dependency>
 
        </dependencies>
 
+       <build>
+               <plugins>
+                       <!--
+            https://issues.apache.org/jira/browse/DIRSHARED-134
+            Required to pull the Mini-KDC transitive dependency
+            -->
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <version>3.0.1</version>
+                               <inherited>true</inherited>
+                               <extensions>true</extensions>
+                       </plugin>
+               </plugins>
+       </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/flink/blob/391efd35/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/SecureTestEnvironment.java
----------------------------------------------------------------------
diff --git 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/SecureTestEnvironment.java
 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/SecureTestEnvironment.java
index 10450c3..febd074 100644
--- 
a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/SecureTestEnvironment.java
+++ 
b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/SecureTestEnvironment.java
@@ -37,9 +37,39 @@ import java.util.Properties;
 /**
  * Helper {@link SecureTestEnvironment} to handle MiniKDC lifecycle.
  * This class can be used to start/stop MiniKDC and create secure 
configurations for MiniDFSCluster
- * and MiniYarn
+ * and MiniYarn.
+ *
+ * If you use this class in your project, please make sure to add a dependency 
to
+ * <tt>hadoop-minikdc</tt>, e.g. in your <tt>pom.xml</tt>:
+ * <pre>{@code
+ * ...
+ * <dependencies>
+ *   <dependency>
+ *     <groupId>org.apache.hadoop</groupId>
+ *     <artifactId>hadoop-minikdc</artifactId>
+ *     <version>${minikdc.version}</version>
+ *     <scope>compile</scope>
+ *   </dependency>
+ * ...
+ * </dependencies>
+ * ...
+ *
+ * <build>
+ *   <plugins>
+ *     <!--
+ *       https://issues.apache.org/jira/browse/DIRSHARED-134
+ *       Required to pull the Mini-KDC transitive dependency
+ *     -->
+ *     <plugin>
+ *     <groupId>org.apache.felix</groupId>
+ *     <artifactId>maven-bundle-plugin</artifactId>
+ *     <version>3.0.1</version>
+ *     <inherited>true</inherited>
+ *     <extensions>true</extensions>
+ *   </plugin>
+ * ...
+ * }</pre>
  */
-
 public class SecureTestEnvironment {
 
        protected static final Logger LOG = 
LoggerFactory.getLogger(SecureTestEnvironment.class);

http://git-wip-us.apache.org/repos/asf/flink/blob/391efd35/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e6fae81..d81296e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1120,16 +1120,6 @@ under the License.
                                </executions>
                        </plugin>
 
-                       <!-- Pull bundled transitive dependencies (i.e. 
Mini-KDC).
-                       See https://issues.apache.org/jira/browse/DIRSHARED-134 
-->
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <version>3.0.1</version>
-                               <inherited>true</inherited>
-                               <extensions>true</extensions>
-                       </plugin>
-
                </plugins>
 
                <!-- Plugin configurations for plugins activated in 
sub-projects --> 

Reply via email to