# Specifying project status on the command line

**URL:** <https://discuss.gradle.org/t/specifying-project-status-on-the-command-line/40063>\
**Category:** Help/Discuss\
**Created:** [May 26, 2021, 3:14am UTC](https://discuss.gradle.org/t/specifying-project-status-on-the-command-line/40063 "2021-05-26T03:14:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddimitrov](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ddimitrov/32/141_2.png) [@ddimitrov](https://discuss.gradle.org/u/ddimitrov)\
**Post date:** [May 26, 2021, 3:14am UTC](https://discuss.gradle.org/t/specifying-project-status-on-the-command-line/40063/1 "2021-05-26T03:14:09Z")

</div>

In many projects we do not specify a version and let our CI infra to provide it with `-Pversion=...`

Now we are trying to apply the same pattern with project status, and it doesn’t seem to work:

Consider the build:

```gradle
logger.lifecycle("before: $status")
if (status=='release') status = 'snapshot'
logger.lifecycle("after: $status")

```

The expectation is that if we run with `-Pstatus=release` the project will have status `release`, in all other cases - `snapshot`. In practice, the status is always `snapshot`

This works, but is way overwrought:

```gradle
logger.lifecycle("before: $status")
project.status = (ext.properties.status ?: gradle.startParameter.projectProperties.get('status'))=='release' ? 'release' : 'snapshot'
logger.lifecycle("after: $status")

```

I would appreciate any suggestions how to structure this, or if I should raise an issue.

---

<div class="post-metadata">

**Author:** ![ddimitrov](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ddimitrov/32/141_2.png) [@ddimitrov](https://discuss.gradle.org/u/ddimitrov)\
**Post date:** [May 30, 2021, 7:31am UTC](https://discuss.gradle.org/t/specifying-project-status-on-the-command-line/40063/2 "2021-05-30T07:31:25Z")

</div>

After getting no reply of acknowledgement in the forum, I reported this as:

> <https://github.com/gradle/gradle/issues/17315>
>
> \### Expected Behavior
> In many projects we do not specify a version and let ou…r CI infra to provide it with \`-Pversion=...\`
> 
> We'd like to also be able to specify \`-Dstatus=...\` to override the default status.
> 
> \### Current Behavior
> Now we are trying to apply the same pattern with project status, and it doesn't seem to work:
> 
> Consider the build:
> 
> \`\`\`
> logger.lifecycle("before: $status")
> if (status=='release') status = 'snapshot'
> logger.lifecycle("after: $status")
> \`\`\`
> 
> The expectation is that if we run with \`-Pstatus=release\` the project will have status \`release\`, in all other cases - \`snapshot\`. In practice, the status is always \`snapshot\`
> 
> This works, but is way overwrought:
> 
> \`\`\`
> logger.lifecycle("before: $status")
> project.status = (ext.properties.status ?: gradle.startParameter.projectProperties.get('status'))=='release' ? 'release' : 'snapshot'
> logger.lifecycle("after: $status")
> \`\`\`
> 
> \### Context
> Some of our builds have conditional behavior, which makes sense to model as build status, except that we are triggering it with nonstandard property (i.e. \`myCompanyBuildStatus\`). Using \`status\` in the same way we use \`version\` would make it cleaner and more intuitive.
