Class: Buildr::Packaging::Java::WarTask

Inherits:
JarTask show all
Defined in:
lib/buildr/java/packaging.rb

Overview

Extends the JarTask to create a WAR file.

Supports all the same options as JarTask, in additon to these two options:

  • :libs – An array of files, tasks, artifact specifications, etc that will be added to the WEB-INF/lib directory.

  • :classes – A directory containing class files for inclusion in the WEB-INF/classes directory.

For example:

package(:war).with(:libs=>'log4j:log4j:jar:1.1')

Instance Attribute Summary collapse

Attributes inherited from ZipTask

#compression_level

Instance Method Summary collapse

Methods inherited from JarTask

#with

Methods inherited from ZipTask

#entries, #entry

Methods inherited from ArchiveTask

#clean, #contain?, #empty?, #exclude, #include, #invoke_prerequisites, #merge, #needed?, #path, #root, #with

Methods inherited from Rake::FileTask

#contain?, #empty?, #exist?

Constructor Details

#initialize(*args) ⇒ WarTask

:nodoc:



254
255
256
257
258
259
260
261
262
# File 'lib/buildr/java/packaging.rb', line 254

def initialize(*args) #:nodoc:
  super
  @classes = []
  @libs = []
  prepare do
    @classes.to_a.flatten.each { |classes| path('WEB-INF/classes').include classes, :as=>'.' }
    path('WEB-INF/lib').include Buildr.artifacts(@libs) unless @libs.nil? || @libs.empty?
  end
end

Instance Attribute Details

#classesObject

Directories with class files to include under WEB-INF/classes.



249
250
251
# File 'lib/buildr/java/packaging.rb', line 249

def classes
  @classes
end

#libsObject

Artifacts to include under WEB-INF/libs.



252
253
254
# File 'lib/buildr/java/packaging.rb', line 252

def libs
  @libs
end