Class: Raven::WarTask
- Inherits:
-
Rake::Task
- Object
- Rake::Task
- Raven::WarTask
- Defined in:
- lib/raven/java_tasks.rb
Overview
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.
Constant Summary collapse
- DEFAULT_TARGET =
'target/webapp/'- LIB_SUBDIR =
'WEB-INF/lib/'- CLASSES_SUBDIR =
'WEB-INF/classes/'
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/raven/java_tasks.rb', line 201 def execute super # Build target structure @webapp_dir = @webapp_dir || 'src/main/webapp' Raven.mkdir_recurse(DEFAULT_TARGET) puts "Using web application directory #{@webapp_dir}" if RakeFileUtils.verbose_flag FileUtils.cp_r(@webapp_dir, DEFAULT_TARGET) # Eventually add classes compiled by javac if (File.exist?('target/classes')) Raven.mkdir_recurse(DEFAULT_TARGET + CLASSES_SUBDIR) FileUtils.cp_r('target/classes/.', DEFAULT_TARGET + CLASSES_SUBDIR) end # Make lib directory with all dependencies Raven.mkdir_recurse(DEFAULT_TARGET + LIB_SUBDIR) Raven.mk_libs(DEFAULT_TARGET + LIB_SUBDIR, prerequisites) # Build the war `jar -cf target/#{name} -C #{DEFAULT_TARGET} .` end |
#webapp_dir=(param) ⇒ Object
226 227 228 |
# File 'lib/raven/java_tasks.rb', line 226 def webapp_dir=(param) @webapp_dir = param end |