Skip to content

Instantly share code, notes, and snippets.

@mkristian
Last active December 23, 2015 23:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkristian/6713449 to your computer and use it in GitHub Desktop.
Save mkristian/6713449 to your computer and use it in GitHub Desktop.
Mavenfile to use warbler to create the war file and replaces the maven artifact with that. the pom.xml is equivalent to the Mavenfile which got genreated by ruby-maven/tesla.
packaging :war
phase :package do
plugin 'de.saumya.mojo:jruby-maven-plugin', '1.0.0-rc3' do
execute_goal( :jruby,
:id => 'pack-war with warbler',
:filename => 'warble',
:gemUseSystem => true )
execute_goal( :jruby,
:id => 'move war to maven build dir',
:script => <<EOS
require 'fileutils'
FileUtils.mv '${project.artifactId}.war', '${project.build.directory}/${project.build.finalName}.war'
EOS
)
end
end
# the maven-war-plugin will fail since maven specific files are not there
plugin :war, :failOnMissingWebXml => false
# tesla or ruby-maven will dump an equivalent pom.xml
properties( 'tesla.dump.pom' => 'pom.xml' )
# vim: syntax=Ruby
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>dummy</groupId>
<artifactId>dhammapada</artifactId>
<version>0.0.0</version>
<packaging>war</packaging>
<name>dhammapada</name>
<properties>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
</properties>
<build>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>jruby-maven-plugin</artifactId>
<version>1.0.0-rc3</version>
<executions>
<execution>
<id>pack-war</id>
<phase>package</phase>
<goals>
<goal>jruby</goal>
</goals>
<configuration>
<filename>warble</filename>
<gemUseSystem>true</gemUseSystem>
</configuration>
</execution>
<execution>
<id>move to build dir</id>
<phase>package</phase>
<goals>
<goal>jruby</goal>
</goals>
<configuration>
<script>
require 'fileutils'
FileUtils.mv '${project.artifactId}.war', '${project.build.directory}/${project.build.finalName}.war'
</script>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment