Class: Buildr::Packaging::Java::JarTask

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

Overview

Extends the ZipTask to create a JAR file.

This task supports two additional attributes: manifest and meta-inf.

The manifest attribute specifies how to create the MANIFEST.MF file.

  • A hash of manifest properties (name/value pairs).

  • An array of hashes, one for each section of the manifest.

  • A string providing the name of an existing manifest file.

  • A file task can be used the same way.

  • Proc or method called to return the contents of the manifest file.

  • False to not generate a manifest file.

The meta-inf attribute lists one or more files that should be copied into the META-INF directory.

For example:

package(:jar).with(:manifest=>'src/MANIFEST.MF')
package(:jar).meta_inf << file('README')

Direct Known Subclasses

AarTask, EarTask, WarTask

Instance Attribute Summary

Attributes inherited from ZipTask

#compression_level

Instance Method Summary collapse

Methods inherited from ZipTask

#entries, #entry

Methods inherited from ArchiveTask

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

Methods inherited from Rake::FileTask

#contain?, #empty?, #exist?

Constructor Details

#initialize(*args) ⇒ JarTask

:nodoc:



213
214
215
# File 'lib/buildr/java/packaging.rb', line 213

def initialize(*args) #:nodoc:
  super
end

Instance Method Details

#with(*args) ⇒ Object

:call-seq:

with(options) => self

Additional Pass options to the task. Returns self. ZipTask itself does not support any options, but other tasks (e.g. JarTask, WarTask) do.

For example:

package(:jar).with(:manifest=>'MANIFEST_MF')


226
227
228
229
230
231
# File 'lib/buildr/java/packaging.rb', line 226

def with(*args)
  super args.pop if Hash === args.last
  fail "package.with() should not contain nil values" if args.include? nil
  include :from=>args if args.size > 0
  self
end