grails cli runs wrong project
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
In the grails documentation about plugins, it suggests the following structure:
https://docs.grails.org/latest/guide/plugins.html
```
PROJECT_DIR
- settings.gradle
- myapp
- build.gradle
- myplugin
- build.gradle
```
However this is kind of inconvenient because you've got settings.gradle lost outside of any git repository, and it seems wasteful to have a repository just for one file. One might therefore suggest this structure:
```
PROJECT_DIR
- myapp
- settings.gradle
- build.gradle
- myplugin
- build.gradle
```
gradle has a special directive for this flat structure. When using the above structure your settings.gradle would look like this:
`includeFlat 'myplugin'
`
This will build the project fine, and one can even run it fine when one is in the myapp directory with...
`gradle bootRun`
HOWEVER.. if one runs from within the myapp directory...
`grails run-app`
instead of running myapp, it runs myplugin.. and if myplugin has its own UI, it will open the browser window displaying the myplugin UI. Then you get output on the console like this:
Running application...
> Task :myplugin:bootRun
I'm not an expert on how all this works, but it seems to me if gradle bootRun is able to figure out what it's supposed to do, the fact that grails cli does the wrong thing seems like a bug to me. And there doesn't seem to be any arguments to grails run-app that would help it do the right thing either.
Contributor guide
Research direction
Start with the plugin documentation at https://docs.grails.org/latest/guide/plugins.html and reproduce the reported layout using settings.gradle, myapp/build.gradle, and myplugin/build.gradle. Compare `gradle bootRun` with `grails run-app` from the myapp directory, then trace the Grails CLI project-selection entry point. Done means `grails run-app` starts myapp rather than myplugin.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100