views:

450

answers:

1

Hi,

I've built a Maven Grails project which can be build fine using command mvn grails:war.

However, using the standard mvn install fails to work - I get exceptions complaining that a util Java class (held under the grails-app/util folder) can't compile because it can't find one of the domain classes.

I'm not using any package structures, so the domain class isn't imported to the util class.

I suppose my first question is - does Maven fully support the building of a mavenised Grails project? Should I be expecting mvn install to work?

My second question is - If i'm forced to build the app using mvn grails:war - how do I enforce this when the parent project / pom has it as a dependant module?

+2  A: 

I suppose my first question is - does Maven fully support the building of a mavenised Grails project? Should I be expecting mvn install to work?

According to Developer - Maven Integration, yes, definitely. Did you follow the steps detailed in Maven Integration? Did you use the grails archetype to create your project? Is it really using a packaging of type grails-app?

My second question is - If i'm forced to build the app using mvn grails:war - how do I enforce this when the parent project / pom has it as a dependant module?

According to the lifecycle of a project with a packaging of type grails-app, the grails:war goal is bound to the package phase. In other words, nothing forces you to call grails:war, just call mvn package (and actually, you should do this) or any other standard phase posterior to package.

So, to answer your question, just use a <packaging>grails-app</packaging> for the grails module and maven will do its job during a reactor build.

Pascal Thivent
Thanks for your answer. I had followed the steps detailed in Maven Integration using the grails archetype to create the project.I hadn't tried building using package (not sure why) - my knowledge of Maven is limited so thank you for explaining your answer clearly.
James Camfield