Question

I am developing prototype for some java project and until now I used multi-module Maven project with a root pom being a parent to 6 more Maven modules. Originally I planned to make a standalone solution with classic GUI based on Swing.

Now I decided that I want to make a web app and try Grails. I googled a lot and researched for a while but can't figure out what will be the easiest way to organize my Maven project. Right now I know how to create empty Grails Maven project. But how should I introduce my other Maven modules to it? What I've come up with currently is:

  1. Create new Grails Maven module, put all sources from other modules into src/java directory in it and copy all dependencies and plugins from other modules pom files to Grails' pom.
  2. Create empty Grails plugins(one per existing java module) and migrate java Maven modules' code and dependencies to Grails plugins pom files.
  3. Setup own local Nexus repository. Put java modules' artifacts in it and reuse them in Grails project. This way keeping Grails development separate from other business-logic development which is done on pure java.

All these three solutions I don't like for obvious reasons:

  1. I will loose modularity and possibility to reuse separate modules of my current java project.
  2. First, too much refactoring. Second, at the end as a result I will not have neither good reusable Maven module, nor Grails plugin (it will only look like one).
  3. I am still at early prototyping stage of my project and I will have to often change java modules in parallel to Grails module development. Obviously it's not very convenient to wait until my java modules after one-liner change get's into Nexus, to see the whole result in Grails.

So, what option should I choose? What are other possibilities? I have this feeling like there is very simple answer to my question after which I will be very ashamed.

Another things which may be relevant here are: I currently use Jenkins to run unit tests for my java modules along with cucumber-jvm acceptance tests, and want to continue doing so; I use IntelliJ Idea 12 as my IDE.

Was it helpful?

Solution

Answer turned out to be really simple. All I had to do was following:

go to folder with root pom run "grails create-app my-app-name" go to created folder with new grails project and run "grails create-pom my.group.id" Add root pom to grails pom.xml generated by grail' last command as parent Add my other 6 maven modules as dependencies to grails' pom. After running "mvn clean install" on my root pom I checked that generated .war file for my Grails module contains all necessary jars from my other modules.

Well, everything turned out to be so simple. Maven is really great, perhaps this all long question appeared because I just didn't expect it to be that great.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top