setup
you have (j)ruby project and you are using warbler to create a war file. now you want to use that war file as maven artifact and/or deploy it on a maven repository (nexus, etc). this post is about how to link these two worlds.
people how use warbler are more at home on the ruby side of things so I am choosing ruby tools for maven to show how this is done. the respective pom.xml are linked at the respective places. tesla is polyglot maven which supports a ruby DSL. the ruby-maven gem is basically the ruby DSL from tesla packed into gem.
simple approach
pom.xml for this.
this will create a war artifact and can be installed or deployed as with any other maven project.
this will create a war artifact and can be installed or deployed as with any other maven project.
note
you will need to make sure that all gems are installed and that warbler is part of the search path of the OS when executing maven. this makes it a more manual approach since all these steps need to be done step by step.
maven approach
now you want to add the project be part of multi module maven project. or as a standalone maven project which is 'selfcontained', i.e. git clone myproject followed by cd myproject and finally maven deploy it to a repository.
so the solution has one big requirements
- all gems must come from rubygems.org, i.e. no gems with path or git declaration inside the Gemfile are possible
pom.xml for this.
this approach has one major disadvantage: you need to keep the list of gems from Gemfile in sync with pom.xml !! but if you use tesla or ruby-maven then the ruby DSL just imports the gem list from the Gemfile into the pom.
this approach has one major disadvantage: you need to keep the list of gems from Gemfile in sync with pom.xml !! but if you use tesla or ruby-maven then the ruby DSL just imports the gem list from the Gemfile into the pom.
remarks on tesla and ruby-maven
tesla is a drop in replacement of maven when you deal with pom.xml only. the other DSLs of tesla do work already OK but there are and will be certain plugins which work only with the XML-DSL (pom.xml).
ruby-maven can run with MRI (needs java installed on the OS) or JRuby. both still have their own individual problems. the jruby version has classloading problems when using the jruby-maven-plugins and the MRI version does not work with multi module projects and parents projects using the ruby DSL.
altogether the DSL might have a few limitation though is fairly complete.
my personal approach right now is to use tesla/ruby-maven to 'translate' the Mavenfile into a pom.xml and include it into version control system. with this anyone with only maven installed can use the project as is. when I work on the Mavenfile or Gemfile I use tesla/ruby-maven to test it which produces the generated pom.xml (you can configure that with property inside the Mavenfile).
enjoy !
enjoy !