require 'maven/tools/rails_project'
module Maven
module Jetty
class RackProject < Maven::Tools::GemProject
tags :dummy
private
CONNECTOR_XML = <<-XML
${jetty.port}
${jetty.sslport}
${project.basedir}/src/test/resources/server.keystore
123456
123456
XML
public
def add_defaults
super
self.properties.merge!({
"jetty.version" => '7.6.4.v20120524',
"jetty.war" => "${project.build.directory}/${project.build.finalName}.war",
"jetty.port" => '8080',
"jetty.sslport" => '8443'
})
profile(:war).plugin("org.mortbay.jetty:jetty-maven-plugin",
"${jetty.version}")do |jetty|
options = {
:war => "${jetty.war}",
:connectors => CONNECTOR_XML
}
jetty.with options
end
profile(:run) do |run|
overrideDescriptor = '${project.build.directory}/jetty/override-${rails.env}-web.xml'
run.activation.by_default
run.plugin("org.mortbay.jetty:jetty-maven-plugin",
"${jetty.version}") do |jetty|
options = {
:webAppConfig => {
:overrideDescriptor => overrideDescriptor
},
:systemProperties => {
:systemProperty => {
:name => 'jbundle.skip',
:value => 'true'
}
},
:connectors => CONNECTOR_XML
}
options[:webXml] = 'config/web.xml' if File.exists?('config/web.xml')
jetty.with options
end
end
end
end
end
end