You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2023/02/13 10:32:39 UTC
[maven-build-cache-extension] branch master updated: [MBUILDCACHE-37] Allow disabled-by-default configuration to be enabled on the CLI (#37)
This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git
The following commit(s) were added to refs/heads/master by this push:
new f91a4d4 [MBUILDCACHE-37] Allow disabled-by-default configuration to be enabled on the CLI (#37)
f91a4d4 is described below
commit f91a4d4030ba25258de2037b4aa459c6fd247b10
Author: Alexander Schwartz <al...@gmx.net>
AuthorDate: Mon Feb 13 11:32:33 2023 +0100
[MBUILDCACHE-37] Allow disabled-by-default configuration to be enabled on the CLI (#37)
---
.../java/org/apache/maven/buildcache/xml/CacheConfigImpl.java | 8 ++++++++
src/site/markdown/usage.md | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java b/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
index f1b06be..5d08a48 100644
--- a/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
@@ -178,6 +178,14 @@ public class CacheConfigImpl implements org.apache.maven.buildcache.xml.CacheCon
}
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;
diff --git a/src/site/markdown/usage.md b/src/site/markdown/usage.md
index 9f8f07d..88145bc 100644
--- a/src/site/markdown/usage.md
+++ b/src/site/markdown/usage.md
@@ -49,7 +49,7 @@ Disable in config:
```xml
<cache>
<configuration>
- <enabled>true</enabled>
+ <enabled>false</enabled>
</configuration>
</cache>
```
@@ -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: