You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2014/04/04 01:49:09 UTC

svn commit: r1584473 - in /lucene/dev/trunk: lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java solr/CHANGES.txt

Author: sarowe
Date: Thu Apr  3 23:49:08 2014
New Revision: 1584473

URL: http://svn.apache.org/r1584473
Log:
SOLR-5950: Maven config: make the org.slf4j:slf4j-api dependency transitive (i.e., not optional) in all modules in which it's a dependency, including solrj, except for the WAR, where it will remain optional.

Modified:
    lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java
    lucene/dev/trunk/solr/CHANGES.txt

Modified: lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java?rev=1584473&r1=1584472&r2=1584473&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java (original)
+++ lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/dependencies/GetMavenDependenciesTask.java Thu Apr  3 23:49:08 2014
@@ -92,17 +92,19 @@ public class GetMavenDependenciesTask ex
   private static final Properties allProperties = new Properties();
   private static final Set<String> modulesWithSeparateCompileAndTestPOMs = new HashSet<>();
 
-  private static final Set<String>  optionalExternalDependencies = new HashSet<>();
+  private static final Set<String> globalOptionalExternalDependencies = new HashSet<>();
+  private static final Map<String,Set<String>> perModuleOptionalExternalDependencies = new HashMap<>();
   static {
     // Add modules here that have split compile and test POMs
     // - they need compile-scope deps to also be test-scope deps.
     modulesWithSeparateCompileAndTestPOMs.addAll
         (Arrays.asList("lucene-core", "lucene-codecs", "solr-core", "solr-solrj"));
 
-    // Add external dependencies here that should be optional (i.e., not invoke Maven's transitive dep mechanism).
+    // Add external dependencies here that should be optional for all modules
+    // (i.e., not invoke Maven's transitive dependency mechanism).
     // Format is "groupId:artifactId"
-    optionalExternalDependencies.addAll(Arrays.asList
-        ("org.slf4j:jcl-over-slf4j", "org.slf4j:jul-to-slf4j", "org.slf4j:slf4j-api", "org.slf4j:slf4j-log4j12"));
+    globalOptionalExternalDependencies.addAll(Arrays.asList
+        ("org.slf4j:jcl-over-slf4j", "org.slf4j:jul-to-slf4j", "org.slf4j:slf4j-log4j12"));
   }
 
   private final XPath xpath = XPathFactory.newInstance().newXPath();
@@ -241,7 +243,7 @@ public class GetMavenDependenciesTask ex
       } catch (BuildException e) {
         throw e;
       } catch (Exception e) {
-        throw new BuildException("Exception reading file " + ivyXmlFile.getPath(), e);
+        throw new BuildException("Exception reading file " + ivyXmlFile.getPath() + ": " + e, e);
       }
     }
     addSharedExternalDependencies();
@@ -257,10 +259,10 @@ public class GetMavenDependenciesTask ex
     // Delay adding shared compile-scope dependencies until after all have been processed,
     // so dependency sharing is limited to a depth of one.
     Map<String,SortedSet<ExternalDependency>> sharedDependencies = new HashMap<>();
-    for (String artifactId : interModuleExternalCompileScopeDependencies.keySet()) {
+    for (String module : interModuleExternalCompileScopeDependencies.keySet()) {
       TreeSet<ExternalDependency> deps = new TreeSet<>();
-      sharedDependencies.put(artifactId, deps);
-      Set<String> moduleDependencies = interModuleExternalCompileScopeDependencies.get(artifactId);
+      sharedDependencies.put(module, deps);
+      Set<String> moduleDependencies = interModuleExternalCompileScopeDependencies.get(module);
       if (null != moduleDependencies) {
         for (String otherArtifactId : moduleDependencies) {
           SortedSet<ExternalDependency> otherExtDeps = allExternalDependencies.get(otherArtifactId); 
@@ -274,13 +276,13 @@ public class GetMavenDependenciesTask ex
         }
       }
     }
-    for (String artifactId : interModuleExternalTestScopeDependencies.keySet()) {
-      SortedSet<ExternalDependency> deps = sharedDependencies.get(artifactId);
+    for (String module : interModuleExternalTestScopeDependencies.keySet()) {
+      SortedSet<ExternalDependency> deps = sharedDependencies.get(module);
       if (null == deps) {
         deps = new TreeSet<>();
-        sharedDependencies.put(artifactId, deps);
+        sharedDependencies.put(module, deps);
       }
-      Set<String> moduleDependencies = interModuleExternalTestScopeDependencies.get(artifactId);
+      Set<String> moduleDependencies = interModuleExternalTestScopeDependencies.get(module);
       if (null != moduleDependencies) {
         for (String otherArtifactId : moduleDependencies) {
           int testScopePos = otherArtifactId.indexOf(":test");
@@ -294,8 +296,8 @@ public class GetMavenDependenciesTask ex
             for (ExternalDependency otherDep : otherExtDeps) {
               if (otherDep.isTestDependency == isTestScope) {
                 if (  ! deps.contains(otherDep)
-                   && (  null == allExternalDependencies.get(artifactId)
-                      || ! allExternalDependencies.get(artifactId).contains(otherDep))) { 
+                   && (  null == allExternalDependencies.get(module)
+                      || ! allExternalDependencies.get(module).contains(otherDep))) {
                   // Add test-scope clone only if it's not already a compile-scope dependency. 
                   ExternalDependency otherDepTestScope = new ExternalDependency
                       (otherDep.groupId, otherDep.artifactId, otherDep.classifier, true, otherDep.isOptional);
@@ -307,13 +309,21 @@ public class GetMavenDependenciesTask ex
         }
       }
     }
-    for (String artifactId : sharedDependencies.keySet()) {
-      SortedSet<ExternalDependency> deps = allExternalDependencies.get(artifactId);
+    for (String module : sharedDependencies.keySet()) {
+      SortedSet<ExternalDependency> deps = allExternalDependencies.get(module);
       if (null == deps) {
         deps = new TreeSet<>();
-        allExternalDependencies.put(artifactId, deps);
+        allExternalDependencies.put(module, deps);
+      }
+      for (ExternalDependency dep : sharedDependencies.get(module)) {
+        String dependencyCoordinate = dep.groupId + ":" + dep.artifactId;
+        if (globalOptionalExternalDependencies.contains(dependencyCoordinate)
+            || (perModuleOptionalExternalDependencies.containsKey(module)
+                && perModuleOptionalExternalDependencies.get(module).contains(dependencyCoordinate))) {
+          dep = new ExternalDependency(dep.groupId, dep.artifactId, dep.classifier, dep.isTestDependency, true);
+        }
+        deps.add(dep);
       }
-      deps.addAll(sharedDependencies.get(artifactId));
     }
   }
 
@@ -671,7 +681,9 @@ public class GetMavenDependenciesTask ex
       }
       String conf = dependency.getAttribute("conf");
       boolean confContainsTest = conf.contains("test");
-      boolean isOptional = optionalExternalDependencies.contains(dependencyCoordinate);
+      boolean isOptional = globalOptionalExternalDependencies.contains(dependencyCoordinate)
+          || ( perModuleOptionalExternalDependencies.containsKey(module)
+              && perModuleOptionalExternalDependencies.get(module).contains(dependencyCoordinate));
       SortedSet<ExternalDependency> deps = allExternalDependencies.get(module);
       if (null == deps) {
         deps = new TreeSet<>();

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1584473&r1=1584472&r2=1584473&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Thu Apr  3 23:49:08 2014
@@ -188,6 +188,11 @@ Bug Fixes
 * SOLR-5951: Fixed SolrDispatchFilter to throw useful exception on startup if
   SLF4j logging jars are missing.  (Uwe Schindler, Hossman, Shawn Heisey)
 
+* SOLR-5950: Maven config: make the org.slf4j:slf4j-api dependency transitive
+  (i.e., not optional) in all modules in which it's a dependency, including
+  solrj, except for the WAR, where it will remain optional.
+  (Uwe Schindler, Steve Rowe)
+
 Optimizations
 ----------------------
 * SOLR-1880: Distributed Search skips GET_FIELDS stage if EXECUTE_QUERY