You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/09/18 07:09:52 UTC
svn commit: r998400 - in /buildr/trunk: CHANGELOG
lib/buildr/java/packaging.rb spec/java/packaging_spec.rb
Author: toulmean
Date: Sat Sep 18 05:09:52 2010
New Revision: 998400
URL: http://svn.apache.org/viewvc?rev=998400&view=rev
Log:
BUILDR-335 follow up: excluding libraries from war is confusing
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/java/packaging.rb
buildr/trunk/spec/java/packaging_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=998400&r1=998399&r2=998400&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sat Sep 18 05:09:52 2010
@@ -22,6 +22,7 @@
* Fixed: BUILDR-302 Move out-of-date Nailgun documentation to wiki (Shane Witbeck)
* Fixed: BUILDR-317 ecj compiler
* Fixed: BUILDR-326 follow up: binary safe untarring on Windows (Sam Hendley)
+* Fixed: BUILDR-335 follow up: excluding libraries from war is confusing
* Fixed: BUILDR-342 The jruby gem installer invokes the removed Gem.manage_gems function (Rhett Sutphin)
* Fixed: BUILDR-403 Buildr::Util::Gems.install does not find gems on remote sources
* Fixed: BUILDR-436 release task should only replace "-SNAPSHOT" (spec from Jean-Philippe Caruana)
Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=998400&r1=998399&r2=998400&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Sat Sep 18 05:09:52 2010
@@ -256,8 +256,9 @@ module Buildr
super
@classes = []
@libs = []
- prepare do
- @classes.to_a.flatten.each { |classes| path('WEB-INF/classes').include classes, :as=>'.' }
+ enhance do |war|
+ @libs.each {|lib| lib.invoke}
+ @classes.to_a.flatten.each { |classes| include classes, :as => 'WEB-INF/classes' }
path('WEB-INF/lib').include Buildr.artifacts(@libs) unless @libs.nil? || @libs.empty?
end
end
Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=998400&r1=998399&r2=998400&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Sat Sep 18 05:09:52 2010
@@ -596,11 +596,31 @@ describe Packaging, 'war' do
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
end
- it 'should exclude files regardless of the path where they are included' do
+ it 'should exclude files regardless of the path where they are included, using wildcards' do
make_jars
define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:war).exclude('**/id-2.0.jar') }
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
end
+
+ it 'should exclude files regardless of the path where they are included, specifying target path entirely' do
+ make_jars
+ define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:war).exclude('WEB-INF/lib/id-2.0.jar') }
+ inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
+ end
+
+ it 'should exclude files regardless of the path where they are included for war files' do
+ write 'src/main/java/com/example/included/Test.java', 'package com.example.included; class Test {}'
+ write 'src/main/java/com/example/excluded/Test.java', 'package com.example.excluded; class Test {}'
+ define('foo', :version=>'1.0') do
+ package(:war).enhance do |war|
+ war.exclude('WEB-INF/classes/com/example/excluded/**.class')
+ end
+ end
+ inspect_war do |files|
+ files.should include('WEB-INF/classes/com/example/included/Test.class')
+ files.should_not include('WEB-INF/classes/com/example/excluded/Test.class')
+ end
+ end
it 'should include only specified libraries' do
define 'foo', :version=>'1.0' do