mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-10-14 14:10:52 +00:00
Add property to disable model caching
This is mostly for the integration tests of the Gradle Enterprise Maven extension,
which heavily test dependency resolution and reuse the same GAVs in many test,
e.g. a🅱️1.0. It would be a lot of effort to rewrite all those tests and a shame
to restart the daemon every time. So I wanted to ask if you'd consider this flag
to disable the caching altogether.
This commit is contained in:

committed by
Peter Palaga

parent
b97f585c09
commit
0b55c8f3e6
@@ -163,6 +163,13 @@ public enum Environment {
|
|||||||
* non-native clients and is useful mostly for debugging.
|
* non-native clients and is useful mostly for debugging.
|
||||||
*/
|
*/
|
||||||
MVND_NO_DAEMON("mvnd.noDaemon", "MVND_NO_DAEMON", Boolean.FALSE, OptionType.BOOLEAN, Flags.DISCRIMINATING),
|
MVND_NO_DAEMON("mvnd.noDaemon", "MVND_NO_DAEMON", Boolean.FALSE, OptionType.BOOLEAN, Flags.DISCRIMINATING),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If <code>true</code>, the daemon will not use its in-memory metadata cache and instead re-read the
|
||||||
|
* metadata from the pom.xml files in the local repository. This is mostly useful for testing purposes.
|
||||||
|
*/
|
||||||
|
MVND_NO_MODEL_CACHE("mvnd.noModelCache", null, Boolean.FALSE, OptionType.BOOLEAN, Flags.OPTIONAL),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If <code>true</code>, the daemon will be launched in debug mode with the following JVM argument:
|
* If <code>true</code>, the daemon will be launched in debug mode with the following JVM argument:
|
||||||
* <code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000</code>; otherwise the debug argument is
|
* <code>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000</code>; otherwise the debug argument is
|
||||||
|
@@ -29,6 +29,8 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
|
|||||||
import org.eclipse.aether.RepositorySystemSession;
|
import org.eclipse.aether.RepositorySystemSession;
|
||||||
import org.eclipse.sisu.Priority;
|
import org.eclipse.sisu.Priority;
|
||||||
|
|
||||||
|
import static org.mvndaemon.mvnd.common.Environment.MVND_NO_MODEL_CACHE;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Named
|
@Named
|
||||||
@Priority(10)
|
@Priority(10)
|
||||||
@@ -45,6 +47,10 @@ public class SnapshotModelCacheFactory implements ModelCacheFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModelCache createCache(RepositorySystemSession session) {
|
public ModelCache createCache(RepositorySystemSession session) {
|
||||||
return new SnapshotModelCache(globalCache, factory.createCache(session));
|
boolean noModelCache =
|
||||||
|
Boolean.parseBoolean(MVND_NO_MODEL_CACHE.asOptional().orElse(MVND_NO_MODEL_CACHE.getDefault()));
|
||||||
|
ModelCache reactorCache = factory.createCache(session);
|
||||||
|
ModelCache globalCache = noModelCache ? reactorCache : this.globalCache;
|
||||||
|
return new SnapshotModelCache(globalCache, reactorCache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -218,7 +218,7 @@ _mvnd()
|
|||||||
|
|
||||||
local mvnd_opts="-1"
|
local mvnd_opts="-1"
|
||||||
local mvnd_long_opts="--color|--completion|--purge|--raw-streams|--serial|--status|--stop"
|
local mvnd_long_opts="--color|--completion|--purge|--raw-streams|--serial|--status|--stop"
|
||||||
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.rawStreams|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketConnectTimeout|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home"
|
local mvnd_properties="-Djava.home|-Djdk.java.options|-Dmaven.multiModuleProjectDirectory|-Dmaven.repo.local|-Dmaven.settings|-Dmvnd.buildTime|-Dmvnd.builder|-Dmvnd.cancelConnectTimeout|-Dmvnd.connectTimeout|-Dmvnd.daemonStorage|-Dmvnd.debug|-Dmvnd.debug.address|-Dmvnd.duplicateDaemonGracePeriod|-Dmvnd.enableAssertions|-Dmvnd.expirationCheckDelay|-Dmvnd.home|-Dmvnd.idleTimeout|-Dmvnd.jvmArgs|-Dmvnd.keepAlive|-Dmvnd.logPurgePeriod|-Dmvnd.logback|-Dmvnd.maxHeapSize|-Dmvnd.maxLostKeepAlive|-Dmvnd.minHeapSize|-Dmvnd.minThreads|-Dmvnd.noBuffering|-Dmvnd.noDaemon|-Dmvnd.noModelCache|-Dmvnd.pluginRealmEvictPattern|-Dmvnd.propertiesPath|-Dmvnd.rawStreams|-Dmvnd.registry|-Dmvnd.rollingWindowSize|-Dmvnd.serial|-Dmvnd.socketConnectTimeout|-Dmvnd.socketFamily|-Dmvnd.threadStackSize|-Dmvnd.threads|-Dstyle.color|-Duser.dir|-Duser.home"
|
||||||
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}"
|
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X|${mvnd_opts}"
|
||||||
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}"
|
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug|${mvnd_long_opts}"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user