Applying Java plugin resets the project status

Consider the following simple build:

status = 'release'
    apply plugin: 'java'
    assert status=='release'

The assertion on the last line would fail, because the Java plugin applies the base plugin (even if it already has been applied once) and the base plugin unconditionally sets the project status to ‘integration’.

This can be difficult to spot in large multi-project builds, and the end result in our case is that the project always publishes to the integration repo.

The culprit is

A possible fix would be to change line 142 to:

if (!project.hasProperty('status')) {
    project.setProperty("status", "integration");

If you want to ensure the status is set properly regardless of configuration ordering you can do something like this.

plugins.withId(‘java’) {

status = ‘release’


This is, and you’ll see from Adam’s comment on that we would be open to some sort of conditional setting of this value in the BasePlugin. Your idea is one option; another would be to use a convention mapping.

Please send a pull request if you’re interested in taking this further.