Class Raven::WarTask
In: lib/raven/java_tasks.rb
Parent: Rake::Task

Produces a WAR from a web application directory. Includes the libraries needed in WEB-INF/lib (as long as the corresponding dependency task is declared as a prerequisite) and the compiled classes (if there are).

Can be customized by setting webapp_dir to the directory containing your web application resources (web.xml, jsp, images, …). The default is src/main/webapp.

Methods

Constants

DEFAULT_TARGET = 'target/webapp/'
LIB_SUBDIR = 'WEB-INF/lib/'
CLASSES_SUBDIR = 'WEB-INF/classes/'

Public Instance methods

[Source]

     # File lib/raven/java_tasks.rb, line 202
202:       def execute
203:         super
204:         
205:         # Build target structure

206:         @webapp_dir = @webapp_dir || 'src/main/webapp'
207:         Raven.mkdir_recurse(DEFAULT_TARGET)
208:         
209:         puts "Using web application directory #{@webapp_dir}" if RakeFileUtils.verbose_flag
210:         
211:         FileUtils.cp_r(@webapp_dir, DEFAULT_TARGET)
212:         
213:         # Eventually add classes compiled by javac

214:         if (File.exist?('target/classes'))
215:           Raven.mkdir_recurse(DEFAULT_TARGET + CLASSES_SUBDIR)
216:           FileUtils.cp_r('target/classes/.', DEFAULT_TARGET + CLASSES_SUBDIR)
217:         end
218:         
219:         # Make lib directory with all dependencies

220:         Raven.mkdir_recurse(DEFAULT_TARGET + LIB_SUBDIR)
221:         Raven.mk_libs(DEFAULT_TARGET + LIB_SUBDIR, prerequisites)
222:         
223:         # Build the war

224:         `jar -cf target/#{name} -C #{DEFAULT_TARGET} .`
225:       end

[Source]

     # File lib/raven/java_tasks.rb, line 227
227:       def webapp_dir=(param)
228:         @webapp_dir = param
229:       end

[Validate]