apache / apache/grails-core

Getting app version returns null when starting application with the main method

Open
#10,523 8 comments 1 reaction 0 assignees View on GitHub
info: workaround available
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

While running a Grails app I see a difference between running as a java app and running from Gralde, when trying to get the version of the app, from the metadata.

### Steps to Reproduce

1. Run a Grails 3.x app as a Java app using Application.groovy's main method
2. Running Application.metadata.getApplicationVersion() returns null
While alternatively,
1. Run a Grails 3.x app using gradle bootRun
2. Running Application.metadata.getApplicationVersion() returns the version from build.gradle

### Environment Information

- **Operating System**: CentOS 6
- **Grails Version:** 3.2.x
- **JDK Version:** 1.8

If you need a sample app I can make one just not today, as I don't have time at the moment, but I wanted to log the issue while I remember it.

Contributor guide

Open the contributing guide

Research direction

Start with Application.groovy's main method and the metadata access described in the report, then compare that startup path with Gradle bootRun and the version value from build.gradle. Reproduce the difference on a Grails 3.x application and trace where the application version is populated; done means both launch paths return the expected version.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
backend
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.