Details
-
Type:
Sub-task
-
Status:
Open
-
Priority:
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.
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:
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.
- Generate a project with the Grails Maven plugin.
- Import the project from the SpringSource Tool Suite as a Groovy project.
- 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.