apache / apache/grails-core

Grails 4 bootRun lost build/resources/main/ classpath.

Open
#11,643 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.

### Task List

- [ ] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)

### Steps to Reproduce

Here is a sample `BootStrap.groovy`:

```groovy
class BootStrap {
def init = { servletContext ->
System.getProperties().get("java.class.path").split(File.pathSeparator).each {
println(it)
}
}
}
```

`./gradlew bootRun` or `./grailsw run-app` output:

```txt
/home/fengyu/projects/creative/grails-rest-seed/src/main/resources
/home/fengyu/projects/creative/grails-rest-seed/grails-app/views
/home/fengyu/projects/creative/grails-rest-seed/grails-app/i18n
/home/fengyu/projects/creative/grails-rest-seed/grails-app/conf
/home/fengyu/projects/creative/grails-rest-seed/grails-app/migrations
/home/fengyu/projects/creative/grails-rest-seed/build/classes/java/main
/home/fengyu/projects/creative/grails-rest-seed/build/classes/groovy/main
/home/fengyu/projects/creative/grails-rest-seed/build/gson-classes/main
/home/fengyu/.gradle/caches/modules-2/files-2.1/org.springframework.boot/ ...
...
```

Lost `build/resources/main` in classpath.

But `./gradlew check` or `./grailsw test-app` output:

```txt
/home/fengyu/projects/creative/grails-rest-seed/build/classes/java/integrationTest
/home/fengyu/projects/creative/grails-rest-seed/build/classes/groovy/integrationTest
/home/fengyu/projects/creative/grails-rest-seed/build/resources/integrationTest
/home/fengyu/projects/creative/grails-rest-seed/build/classes/java/main
/home/fengyu/projects/creative/grails-rest-seed/build/classes/groovy/main
/home/fengyu/projects/creative/grails-rest-seed/build/resources/main # <===== Here
/home/fengyu/projects/creative/grails-rest-seed/build/gson-classes/main
/home/fengyu/projects/creative/grails-rest-seed/build/classes/java/test
/home/fengyu/projects/creative/grails-rest-seed/build/classes/groovy/test
/home/fengyu/projects/creative/grails-rest-seed/build/resources/test
/home/fengyu/.gradle/caches/modules-2/files-2.1/org.springframework.boot/...
...
```

Contains `build/resources/main` in classpath

### Expected Behaviour

`bootRun` should contain `build/resources/main` classpath

### Actual Behaviour

Since Grails 4.0 lost `build/resources/main` classpath when bootRun

### Environment Information

- **Operating System**: Linux
- **Grails Version:** 4.0.5
- **JDK Version:** 1.8
- **Container Version (If Applicable):** TODO

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the classpath output with ./gradlew bootRun or ./grailsw run-app, then compare it with ./gradlew check or ./grailsw test-app. The change is done when bootRun includes build/resources/main in its classpath, matching the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.