Repository: buildr
Updated Branches:
  refs/heads/master 13dc0b68c -> 75e72a94f


Avoid generating sections if there is no content


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/3da552b8
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/3da552b8
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/3da552b8

Branch: refs/heads/master
Commit: 3da552b879854238086d3348e0e128258a13d611
Parents: 13dc0b6
Author: Peter Donald <[email protected]>
Authored: Mon Feb 20 10:48:24 2017 +1100
Committer: Peter Donald <[email protected]>
Committed: Mon Feb 20 12:22:25 2017 +1100

----------------------------------------------------------------------
 lib/buildr/java/custom_pom.rb | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/3da552b8/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
index 739d95a..8e1921b 100644
--- a/lib/buildr/java/custom_pom.rb
+++ b/lib/buildr/java/custom_pom.rb
@@ -173,7 +173,7 @@ module Buildr
                 xml.distribution 'repo'
               end
             end
-          end
+          end unless project.pom.licenses.empty?
 
           if project.pom.scm_url || project.pom.scm_connection || 
project.pom.scm_developer_connection
             xml.scm do
@@ -205,23 +205,24 @@ module Buildr
                 end
               end
             end
-          end
+          end unless project.pom.developers.empty?
+
+          provided_deps = 
Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
+          runtime_deps = 
Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
+          optional_deps = 
Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
+          deps =
+            Buildr.artifacts(project.compile.dependencies).
+              select { |d| d.is_a?(ActsAsArtifact) }.
+              collect do |d|
+              f = d.to_s
+              scope = provided_deps.include?(f) ? 'provided' :
+                runtime_deps.include?(f) ? 'runtime' :
+                  'compile'
+              d.to_hash.merge(:scope => scope, :optional => 
optional_deps.include?(f))
+            end + Buildr.artifacts(project.test.compile.dependencies).
+              select { |d| d.is_a?(ActsAsArtifact) && 
!project.compile.dependencies.include?(d) }.collect { |d| 
d.to_hash.merge(:scope => 'test') }
 
           xml.dependencies do
-            provided_deps = 
Buildr.artifacts(project.pom.provided_dependencies).collect { |d| d.to_s }
-            runtime_deps = 
Buildr.artifacts(project.pom.runtime_dependencies).collect { |d| d.to_s }
-            optional_deps = 
Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
-            deps =
-              Buildr.artifacts(project.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) }.
-                collect do |d|
-                f = d.to_s
-                scope = provided_deps.include?(f) ? 'provided' :
-                  runtime_deps.include?(f) ? 'runtime' :
-                    'compile'
-                d.to_hash.merge(:scope => scope, :optional => 
optional_deps.include?(f))
-              end + Buildr.artifacts(project.test.compile.dependencies).
-                select { |d| d.is_a?(ActsAsArtifact) && 
!project.compile.dependencies.include?(d) }.collect { |d| 
d.to_hash.merge(:scope => 'test') }
             deps.each do |dependency|
               xml.dependency do
                 xml.groupId dependency[:group]
@@ -237,7 +238,7 @@ module Buildr
                 end
               end
             end
-          end
+          end unless deps.empty?
         end
       end
     end

Reply via email to