Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MBUILDCACHE-37] Allow disabled-by-default configuration to be enabled on the CLI #37

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ else if ( !Boolean.parseBoolean( enabled ) )
}
fillWithDefaults( cacheConfig );

// `maven.build.cache.enabled` overrides the `enabled` of the XML file
// to allow a disabled configuration to be enabled on the command line
final String cacheEnabledProperty = getProperty( CACHE_ENABLED_PROPERTY_NAME, null );
if ( cacheEnabledProperty != null )
{
cacheConfig.getConfiguration().setEnabled( Boolean.parseBoolean( cacheEnabledProperty ) );
}

if ( !cacheConfig.getConfiguration().isEnabled() )
{
state = CacheState.DISABLED;
Expand Down
7 changes: 6 additions & 1 deletion src/site/markdown/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Disable in config:
```xml
<cache>
<configuration>
<enabled>true</enabled>
<enabled>false</enabled>
</configuration>
</cache>
```
Expand All @@ -58,6 +58,11 @@ On command line:
-Dmaven.build.cache.enabled=false
```

When a configuration is disabled by default in the config, it can be enabled via the command line with:
```
-Dmaven.build.cache.enabled=true
```

## IDE support

Build cache extension is generally compatible with IDEs with one limitation:
Expand Down