Grails Maven Plugin

Provide a way to generate a more standard maven structure / fix up the confusing one that is currently generated

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Generated using this:
    mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate -DarchetypeGroupId=org.grails -DarchetypeArtifactId=grails-maven-archetype -DarchetypeVersion=1.0

Description

Currently the plugin simply generates the typical grails app and then adds a few (confusing) maven like directories:
./src
./src/groovy
./src/java
./src/main
./src/main/resources
./src/main/webapp
./src/main/webapp/WEB-INF
./src/main/webapp/WEB-INF/web.xml

These only partially match the maven recommended structure (which would be more like)
src/
main/
groovy/
java/
resources/
webapp/

Also, these don't really seem to be connected to the grails app in a meaningful way and the real meat of the app is still in the grails-app, plugins, and web-app folders so the structures are confusing and somewhat misleading to developers trying to get started with gralls and coming from a java/maven background.

I don't know what the right solution is for this, but I think it might be worth trying to place the grails files into a more maven like structure or just getting rid of these confusing folders.

Activity

Hide
Rossen Stoyanchev added a comment -

The plugin is very useful from the command line. However, the fact that it doesn't use a maven-compatible directory structure has some practical consequences. I ran into a specific use case as follows:

  1. Generate a project with the Grails Maven plugin.
  2. Import the project from the SpringSource Tool Suite as a Groovy project.
  3. Right click the project and enable m2eclipse support (Maven - Enable Dependency Management)

The project is successfully converted to a Maven project with WTP support. However the project cannot be used to deploy to a server within Eclipse because of where webapp artifacts are located.

The ./src/main/webapp directory where webapp artifacts should be is actually not used. The actual webapp files are in a few places:

./grails-app/i18n
./grails-app/views
./web-app

A second issue is that the web.xml is generated and not available under src/main/webapp. There are more Grails-generated, webapp artifacts like grails.xml, HibernateGrailsPlugin, and possibly others that would be needed in order to successfully with WTP.

Show
Rossen Stoyanchev added a comment - The plugin is very useful from the command line. However, the fact that it doesn't use a maven-compatible directory structure has some practical consequences. I ran into a specific use case as follows:
  1. Generate a project with the Grails Maven plugin.
  2. Import the project from the SpringSource Tool Suite as a Groovy project.
  3. Right click the project and enable m2eclipse support (Maven - Enable Dependency Management)
The project is successfully converted to a Maven project with WTP support. However the project cannot be used to deploy to a server within Eclipse because of where webapp artifacts are located. The ./src/main/webapp directory where webapp artifacts should be is actually not used. The actual webapp files are in a few places: ./grails-app/i18n ./grails-app/views ./web-app A second issue is that the web.xml is generated and not available under src/main/webapp. There are more Grails-generated, webapp artifacts like grails.xml, HibernateGrailsPlugin, and possibly others that would be needed in order to successfully with WTP.
Hide
Graeme Rocher added a comment -

The issue here is that Grails requires its directory structure to remain the same otherwise things will go wrong with its plugins / AST transforms etc. I don't see us every fixing this. Tooling (such as STS) will need to be updated to take into account the differing directory structure

Show
Graeme Rocher added a comment - The issue here is that Grails requires its directory structure to remain the same otherwise things will go wrong with its plugins / AST transforms etc. I don't see us every fixing this. Tooling (such as STS) will need to be updated to take into account the differing directory structure

People

Vote (7)
Watch (3)

Dates

  • Created:
    Updated: