Repository: buildr
Updated Branches:
  refs/heads/master 21d9583d0 -> dc66b4fa5


Add the `project.pom.dependency_filter` configuration property to control 
whether a dependency is included in the pom


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

Branch: refs/heads/master
Commit: ab87ec6aff864a34e1b87126b2a1546bb03a0cfa
Parents: 21d9583
Author: Peter Donald <pe...@realityforge.org>
Authored: Thu Mar 22 14:25:11 2018 +1100
Committer: Peter Donald <pe...@realityforge.org>
Committed: Thu Mar 22 14:25:11 2018 +1100

----------------------------------------------------------------------
 CHANGELOG                     | 3 +++
 lib/buildr/java/custom_pom.rb | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/ab87ec6a/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index cad8797..a9aa1e1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 1.5.6 (Pending)
+* Added:  Add the `project.pom.dependency_filter` configuration property that 
can be set to a proc. The proc
+          accepts a dependency and returns a boolean that determines whether 
the dependency is included in
+          the generated pom or not.
 * Fixed:  POMs generated by Buildr use the parent pom 
`org.sonatype.oss:oss-parent:pom:7` but this
           generates a warning in the latest version of Maven. Modern versions 
of Maven would thus
           ignore transitive dependencies declared in the pom. The parent pom 
has now been upgraded

http://git-wip-us.apache.org/repos/asf/buildr/blob/ab87ec6a/lib/buildr/java/custom_pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/custom_pom.rb b/lib/buildr/java/custom_pom.rb
index 0dfc57b..945f9a7 100644
--- a/lib/buildr/java/custom_pom.rb
+++ b/lib/buildr/java/custom_pom.rb
@@ -136,6 +136,10 @@ module Buildr
       @optional_dependencies = optional_dependencies
     end
 
+    # Property that accepts a proc that accepts a dependency and returns a 
boolean to
+    # determine whether dependency is included in pom or not.
+    attr_accessor :dependency_filter
+
     protected
 
     def associate_project(buildr_project)
@@ -224,7 +228,7 @@ module Buildr
               select { |d| d.is_a?(ActsAsArtifact) && 
!project.compile.dependencies.include?(d) }.collect { |d| 
d.to_hash.merge(:scope => 'test') }
 
           xml.dependencies do
-            deps.each do |dependency|
+            deps.select{|dependency| project.pom.dependency_filter.nil? ? true 
: project.pom.dependency_filter.call(dependency) }.each do |dependency|
               xml.dependency do
                 xml.groupId dependency[:group]
                 xml.artifactId dependency[:id]

Reply via email to