Repository: buildr
Updated Branches:
  refs/heads/master 762241885 -> 373e38b47


[BUILDR-701] update harmcrest dependancy version

as seen in https://issues.apache.org/jira/browse/BUILDR-701
junit doesn't come with harmcrest dependancy, we have to add it explicitely

without, some people might experience some ClassNotFoundException

it is possible to overide harmcrest version with 
Buildr.settings.build['harmcrest'],
as it is done with junit or jmock


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

Branch: refs/heads/master
Commit: eb0dfce954bc0261430e3150773d65112c990980
Parents: 472da42
Author: Jean-Philippe CARUANA <[email protected]>
Authored: Thu Jul 31 11:32:24 2014 +0200
Committer: Jean-Philippe CARUANA <[email protected]>
Committed: Thu Jul 31 11:32:24 2014 +0200

----------------------------------------------------------------------
 lib/buildr/java/tests.rb | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/eb0dfce9/lib/buildr/java/tests.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/tests.rb b/lib/buildr/java/tests.rb
index 95ef71d..1f86aab 100644
--- a/lib/buildr/java/tests.rb
+++ b/lib/buildr/java/tests.rb
@@ -103,8 +103,9 @@ module Buildr #:nodoc:
         @dependencies ||= ["#{group}:jmock:jar:#{version}"]
         if two_or_later
           @dependencies << 
"org.jmock:jmock-junit#{Buildr::JUnit.version.to_s[0,1]}:jar:#{version}"
-          @dependencies << "org.hamcrest:hamcrest-core:jar:1.1"
-          @dependencies << "org.hamcrest:hamcrest-library:jar:1.1"
+          Harmcrest.dependencies.each { |dependency|
+            @dependencies << dependency
+          }
         end
         @dependencies
       end
@@ -119,6 +120,23 @@ module Buildr #:nodoc:
   end
 
 
+  # Provides a library of matcher objects (also known as constraints or 
predicates) allowing 'match' rules to be defined declaratively, to be used in 
other frameworks.
+  module Harmcrest
+
+    VERSION = '1.3'
+
+    class << self
+      def version
+        Buildr.settings.build['harmcrest'] || VERSION
+      end
+
+      def dependencies
+        @dependencies ||= ["org.hamcrest:hamcrest-core:jar:#{version}", 
"org.hamcrest:hamcrest-library:jar:#{version}"]
+      end
+
+  end
+
+
   # JUnit test framework, the default test framework for Java tests.
   #
   # Support the following options:
@@ -198,7 +216,7 @@ module Buildr #:nodoc:
       end
 
       def dependencies
-        @dependencies ||= ["junit:junit:jar:#{version}"]+ JMock.dependencies
+        @dependencies ||= ["junit:junit:jar:#{version}"] + JMock.dependencies 
+ Harmcrest.dependencies
       end
 
       def ant_taskdef #:nodoc:

Reply via email to