mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-10-13 21:50:48 +00:00
Fixes (#1253)
Seems MSC fork does not allow pushes from users who have commit rights on forked maven-mvnd, so am incorporating @ascheman changes here as well. This PR is: * fixes from PR https://github.com/apache/maven-mvnd/pull/1252 * plus fix SO isse (self injected cache) * plus migrated whole daemon to Maven DI (from javax.inject) except those that override Sisu components * ported latest Maven changes
This commit is contained in:
@@ -25,9 +25,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.maven.api.cli.InvokerException;
|
||||
import org.apache.maven.api.cli.ParserRequest;
|
||||
import org.apache.maven.cling.invoker.ProtoLogger;
|
||||
import org.apache.maven.cling.invoker.ProtoLookup;
|
||||
import org.apache.maven.cling.invoker.logging.SystemLogger;
|
||||
import org.apache.maven.logging.BuildEventListener;
|
||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
@@ -72,17 +73,25 @@ public class DaemonMavenCling implements DaemonCli {
|
||||
EnvHelper.environment(workingDir, env);
|
||||
System.setProperty("maven.multiModuleProjectDirectory", projectDir);
|
||||
|
||||
return invoker.invoke(parser.parseInvocation(ParserRequest.builder(
|
||||
"mvnd", "Maven Daemon", args, new ProtoLogger(), new DaemonMessageBuilderFactory())
|
||||
.cwd(Paths.get(workingDir))
|
||||
.in(in)
|
||||
.out(out)
|
||||
.err(err)
|
||||
.lookup(ProtoLookup.builder()
|
||||
.addMapping(Environment.class, () -> env)
|
||||
.addMapping(BuildEventListener.class, buildEventListener)
|
||||
.build())
|
||||
.build()));
|
||||
try {
|
||||
return invoker.invoke(parser.parseInvocation(
|
||||
ParserRequest.builder("mvnd", "Maven Daemon", args, new DaemonMessageBuilderFactory())
|
||||
.cwd(Paths.get(workingDir))
|
||||
.stdIn(in)
|
||||
.stdOut(out)
|
||||
.stdErr(err)
|
||||
.lookup(ProtoLookup.builder()
|
||||
.addMapping(Environment.class, () -> env)
|
||||
.addMapping(BuildEventListener.class, buildEventListener)
|
||||
.build())
|
||||
.build()));
|
||||
} catch (InvokerException.ExitException e) {
|
||||
return e.getExitCode();
|
||||
} catch (Exception e) {
|
||||
// last resort; as ideally we should get ExitException only
|
||||
new SystemLogger(err).error(e.getMessage(), e);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,7 +20,6 @@ package org.apache.maven.cli;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.maven.api.cli.InvokerException;
|
||||
import org.apache.maven.api.cli.InvokerRequest;
|
||||
@@ -48,8 +47,8 @@ public class DaemonMavenInvoker extends ResidentMavenInvoker {
|
||||
MessageUtils.systemInstall(
|
||||
builder -> {
|
||||
builder.streams(
|
||||
context.invokerRequest.in().orElseThrow(),
|
||||
context.invokerRequest.out().orElseThrow());
|
||||
context.invokerRequest.stdIn().orElseThrow(),
|
||||
context.invokerRequest.stdOut().orElseThrow());
|
||||
builder.systemOutput(TerminalBuilder.SystemOutput.ForcedSysOut);
|
||||
builder.provider(TerminalBuilder.PROP_PROVIDER_EXEC);
|
||||
if (context.coloredOutput != null) {
|
||||
@@ -68,10 +67,9 @@ public class DaemonMavenInvoker extends ResidentMavenInvoker {
|
||||
@Override
|
||||
protected void doConfigureWithTerminal(MavenContext context, Terminal terminal) {
|
||||
super.doConfigureWithTerminal(context, terminal);
|
||||
Optional<Boolean> rawStreams = context.invokerRequest.options().rawStreams();
|
||||
if (rawStreams.orElse(false)) {
|
||||
System.setOut(printStream(context.invokerRequest.out().orElseThrow()));
|
||||
System.setErr(printStream(context.invokerRequest.err().orElseThrow()));
|
||||
if (context.invokerRequest.options().rawStreams().orElse(false)) {
|
||||
System.setOut(printStream(context.invokerRequest.stdOut().orElseThrow()));
|
||||
System.setErr(printStream(context.invokerRequest.stdErr().orElseThrow()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.apache.maven.api.cli.ParserException;
|
||||
import org.apache.maven.api.cli.extensions.CoreExtension;
|
||||
import org.apache.maven.api.cli.mvn.MavenOptions;
|
||||
import org.apache.maven.cling.internal.extension.io.CoreExtensionsStaxReader;
|
||||
@@ -42,16 +41,12 @@ import org.mvndaemon.mvnd.common.Environment;
|
||||
|
||||
public class DaemonMavenParser extends MavenParser {
|
||||
@Override
|
||||
protected MavenOptions parseArgs(String source, List<String> args) throws ParserException {
|
||||
try {
|
||||
return CommonsCliDaemonMavenOptions.parse(source, args.toArray(new String[0]));
|
||||
} catch (ParseException e) {
|
||||
throw new ParserException("Failed to parse source " + source + ": " + e.getMessage(), e.getCause());
|
||||
}
|
||||
protected MavenOptions parseArgs(String source, List<String> args) throws ParseException {
|
||||
return CommonsCliDaemonMavenOptions.parse(source, args.toArray(new String[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> populateSystemProperties(LocalContext context) throws ParserException {
|
||||
protected Map<String, String> populateSystemProperties(LocalContext context) {
|
||||
HashMap<String, String> systemProperties = new HashMap<>(super.populateSystemProperties(context));
|
||||
Map<String, String> env = context.parserRequest
|
||||
.lookup()
|
||||
|
@@ -18,17 +18,16 @@
|
||||
*/
|
||||
package org.apache.maven.cli;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.api.annotations.Experimental;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.jline.JLineMessageBuilderFactory;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
|
||||
@Named
|
||||
@Singleton
|
||||
@Priority(10)
|
||||
@Priority(20)
|
||||
@Experimental
|
||||
public class DaemonMessageBuilderFactory extends JLineMessageBuilderFactory {
|
||||
|
||||
|
@@ -31,21 +31,11 @@ import org.apache.maven.extension.internal.CoreExtensionEntry;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
|
||||
public class DaemonPlexusContainerCapsuleFactory extends PlexusContainerCapsuleFactory<MavenContext> {
|
||||
|
||||
@Override
|
||||
protected Set<String> collectExportedArtifacts(
|
||||
CoreExtensionEntry coreEntry, List<CoreExtensionEntry> extensionEntries) {
|
||||
HashSet<String> result = new HashSet<>(super.collectExportedArtifacts(coreEntry, extensionEntries));
|
||||
result.add("org.codehaus.plexus:plexus-interactivity-api");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> collectExportedPackages(
|
||||
CoreExtensionEntry coreEntry, List<CoreExtensionEntry> extensionEntries) {
|
||||
HashSet<String> result = new HashSet<>(super.collectExportedPackages(coreEntry, extensionEntries));
|
||||
result.add("org.mvndaemon.mvnd.interactivity");
|
||||
result.add("org.codehaus.plexus.components.interactivity");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.maven.project;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.maven.api.services.Source;
|
||||
import org.apache.maven.api.services.model.ModelCache;
|
||||
|
||||
public class SnapshotModelCache implements ModelCache {
|
||||
|
||||
private final ModelCache globalCache;
|
||||
private final ModelCache reactorCache;
|
||||
|
||||
public SnapshotModelCache(ModelCache globalCache, ModelCache reactorCache) {
|
||||
this.globalCache = Objects.requireNonNull(globalCache);
|
||||
this.reactorCache = Objects.requireNonNull(reactorCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T computeIfAbsent(String groupId, String artifactId, String version, String tag, Supplier<T> data) {
|
||||
return getDelegate(version).computeIfAbsent(groupId, artifactId, version, tag, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T computeIfAbsent(Source path, String tag, Supplier<T> data) {
|
||||
return reactorCache.computeIfAbsent(path, tag, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
reactorCache.clear();
|
||||
}
|
||||
|
||||
private ModelCache getDelegate(String version) {
|
||||
return version.contains("SNAPSHOT") || version.contains("${") ? reactorCache : globalCache;
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.maven.project;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.api.services.model.ModelCache;
|
||||
import org.apache.maven.api.services.model.ModelCacheFactory;
|
||||
import org.apache.maven.internal.impl.model.DefaultModelCacheFactory;
|
||||
|
||||
import static org.mvndaemon.mvnd.common.Environment.MVND_NO_MODEL_CACHE;
|
||||
|
||||
@Singleton
|
||||
@Named
|
||||
@Priority(10)
|
||||
public class SnapshotModelCacheFactory implements ModelCacheFactory {
|
||||
|
||||
private final ModelCacheFactory factory;
|
||||
private final ModelCache globalCache;
|
||||
|
||||
@Inject
|
||||
public SnapshotModelCacheFactory(DefaultModelCacheFactory factory) {
|
||||
this.factory = factory;
|
||||
this.globalCache = factory.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelCache newInstance() {
|
||||
boolean noModelCache =
|
||||
Boolean.parseBoolean(MVND_NO_MODEL_CACHE.asOptional().orElse(MVND_NO_MODEL_CACHE.getDefault()));
|
||||
ModelCache reactorCache = factory.newInstance();
|
||||
ModelCache globalCache = noModelCache ? reactorCache : this.globalCache;
|
||||
return new SnapshotModelCache(globalCache, reactorCache);
|
||||
}
|
||||
}
|
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.maven.settings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.api.model.ActivationFile;
|
||||
import org.apache.maven.api.settings.Activation;
|
||||
import org.apache.maven.api.settings.ActivationOS;
|
||||
import org.apache.maven.api.settings.ActivationProperty;
|
||||
import org.apache.maven.api.settings.Profile;
|
||||
import org.apache.maven.api.settings.Repository;
|
||||
import org.apache.maven.api.settings.RepositoryPolicy;
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.settings.v4.SettingsMerger;
|
||||
|
||||
/**
|
||||
* Several convenience methods to handle settings
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
*/
|
||||
public final class SettingsUtilsV4 {
|
||||
|
||||
private SettingsUtilsV4() {
|
||||
// don't allow construction.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dominant
|
||||
* @param recessive
|
||||
*/
|
||||
public static Settings merge(Settings dominant, Settings recessive) {
|
||||
return new SettingsMerger().merge(dominant, recessive, true, Collections.emptyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modelProfile
|
||||
* @return a profile
|
||||
*/
|
||||
public static Profile convertToSettingsProfile(org.apache.maven.api.model.Profile modelProfile) {
|
||||
Profile.Builder profile = Profile.newBuilder();
|
||||
|
||||
profile.id(modelProfile.getId());
|
||||
|
||||
org.apache.maven.api.model.Activation modelActivation = modelProfile.getActivation();
|
||||
|
||||
if (modelActivation != null) {
|
||||
Activation.Builder activation = Activation.newBuilder();
|
||||
|
||||
activation.activeByDefault(modelActivation.isActiveByDefault());
|
||||
|
||||
activation.jdk(modelActivation.getJdk());
|
||||
|
||||
org.apache.maven.api.model.ActivationProperty modelProp = modelActivation.getProperty();
|
||||
|
||||
if (modelProp != null) {
|
||||
ActivationProperty prop = ActivationProperty.newBuilder()
|
||||
.name(modelProp.getName())
|
||||
.value(modelProp.getValue())
|
||||
.build();
|
||||
activation.property(prop);
|
||||
}
|
||||
|
||||
org.apache.maven.api.model.ActivationOS modelOs = modelActivation.getOs();
|
||||
|
||||
if (modelOs != null) {
|
||||
ActivationOS os = ActivationOS.newBuilder()
|
||||
.arch(modelOs.getArch())
|
||||
.family(modelOs.getFamily())
|
||||
.name(modelOs.getName())
|
||||
.version(modelOs.getVersion())
|
||||
.build();
|
||||
|
||||
activation.os(os);
|
||||
}
|
||||
|
||||
ActivationFile modelFile = modelActivation.getFile();
|
||||
|
||||
if (modelFile != null) {
|
||||
org.apache.maven.api.settings.ActivationFile file =
|
||||
org.apache.maven.api.settings.ActivationFile.newBuilder()
|
||||
.exists(modelFile.getExists())
|
||||
.missing(modelFile.getMissing())
|
||||
.build();
|
||||
|
||||
activation.file(file);
|
||||
}
|
||||
|
||||
profile.activation(activation.build());
|
||||
}
|
||||
|
||||
profile.properties(modelProfile.getProperties().entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
e -> e.getKey().toString(), e -> e.getValue().toString())));
|
||||
|
||||
List<org.apache.maven.api.model.Repository> repos = modelProfile.getRepositories();
|
||||
if (repos != null) {
|
||||
List<Repository> repositories = new ArrayList<>();
|
||||
for (org.apache.maven.api.model.Repository repo : repos) {
|
||||
repositories.add(convertToSettingsRepository(repo));
|
||||
}
|
||||
profile.repositories(repositories);
|
||||
}
|
||||
|
||||
List<org.apache.maven.api.model.Repository> pluginRepos = modelProfile.getPluginRepositories();
|
||||
if (pluginRepos != null) {
|
||||
List<Repository> repositories = new ArrayList<>();
|
||||
for (org.apache.maven.api.model.Repository pluginRepo : pluginRepos) {
|
||||
repositories.add(convertToSettingsRepository(pluginRepo));
|
||||
}
|
||||
profile.pluginRepositories(repositories);
|
||||
}
|
||||
|
||||
return profile.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param settingsProfile
|
||||
* @return a profile
|
||||
*/
|
||||
public static org.apache.maven.api.model.Profile convertFromSettingsProfile(Profile settingsProfile) {
|
||||
org.apache.maven.api.model.Profile.Builder profile = org.apache.maven.api.model.Profile.newBuilder();
|
||||
|
||||
profile.id(settingsProfile.getId());
|
||||
|
||||
Activation settingsActivation = settingsProfile.getActivation();
|
||||
|
||||
if (settingsActivation != null) {
|
||||
org.apache.maven.api.model.Activation.Builder activation =
|
||||
org.apache.maven.api.model.Activation.newBuilder();
|
||||
|
||||
activation.activeByDefault(settingsActivation.isActiveByDefault());
|
||||
|
||||
activation.jdk(settingsActivation.getJdk());
|
||||
|
||||
ActivationProperty settingsProp = settingsActivation.getProperty();
|
||||
if (settingsProp != null) {
|
||||
activation.property(org.apache.maven.api.model.ActivationProperty.newBuilder()
|
||||
.name(settingsProp.getName())
|
||||
.value(settingsProp.getValue())
|
||||
.build());
|
||||
}
|
||||
|
||||
ActivationOS settingsOs = settingsActivation.getOs();
|
||||
if (settingsOs != null) {
|
||||
activation.os(org.apache.maven.api.model.ActivationOS.newBuilder()
|
||||
.arch(settingsOs.getArch())
|
||||
.family(settingsOs.getFamily())
|
||||
.name(settingsOs.getName())
|
||||
.version(settingsOs.getVersion())
|
||||
.build());
|
||||
}
|
||||
|
||||
org.apache.maven.api.settings.ActivationFile settingsFile = settingsActivation.getFile();
|
||||
if (settingsFile != null) {
|
||||
activation.file(ActivationFile.newBuilder()
|
||||
.exists(settingsFile.getExists())
|
||||
.missing(settingsFile.getMissing())
|
||||
.build());
|
||||
}
|
||||
|
||||
profile.activation(activation.build());
|
||||
}
|
||||
|
||||
profile.properties(settingsProfile.getProperties());
|
||||
|
||||
List<Repository> repos = settingsProfile.getRepositories();
|
||||
if (repos != null) {
|
||||
profile.repositories(repos.stream()
|
||||
.map(SettingsUtilsV4::convertFromSettingsRepository)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<Repository> pluginRepos = settingsProfile.getPluginRepositories();
|
||||
if (pluginRepos != null) {
|
||||
profile.pluginRepositories(pluginRepos.stream()
|
||||
.map(SettingsUtilsV4::convertFromSettingsRepository)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
org.apache.maven.api.model.Profile value = profile.build();
|
||||
value.setSource("settings.xml");
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param settingsRepo
|
||||
* @return a repository
|
||||
*/
|
||||
private static org.apache.maven.api.model.Repository convertFromSettingsRepository(Repository settingsRepo) {
|
||||
org.apache.maven.api.model.Repository.Builder repo = org.apache.maven.api.model.Repository.newBuilder();
|
||||
|
||||
repo.id(settingsRepo.getId());
|
||||
repo.layout(settingsRepo.getLayout());
|
||||
repo.name(settingsRepo.getName());
|
||||
repo.url(settingsRepo.getUrl());
|
||||
|
||||
if (settingsRepo.getSnapshots() != null) {
|
||||
repo.snapshots(convertRepositoryPolicy(settingsRepo.getSnapshots()));
|
||||
}
|
||||
if (settingsRepo.getReleases() != null) {
|
||||
repo.releases(convertRepositoryPolicy(settingsRepo.getReleases()));
|
||||
}
|
||||
|
||||
return repo.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param settingsPolicy
|
||||
* @return a RepositoryPolicy
|
||||
*/
|
||||
private static org.apache.maven.api.model.RepositoryPolicy convertRepositoryPolicy(
|
||||
RepositoryPolicy settingsPolicy) {
|
||||
org.apache.maven.api.model.RepositoryPolicy policy = org.apache.maven.api.model.RepositoryPolicy.newBuilder()
|
||||
.enabled(Boolean.toString(settingsPolicy.isEnabled()))
|
||||
.updatePolicy(settingsPolicy.getUpdatePolicy())
|
||||
.checksumPolicy(settingsPolicy.getChecksumPolicy())
|
||||
.build();
|
||||
return policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modelRepo
|
||||
* @return a repository
|
||||
*/
|
||||
private static Repository convertToSettingsRepository(org.apache.maven.api.model.Repository modelRepo) {
|
||||
Repository repo = Repository.newBuilder()
|
||||
.id(modelRepo.getId())
|
||||
.layout(modelRepo.getLayout())
|
||||
.name(modelRepo.getName())
|
||||
.url(modelRepo.getUrl())
|
||||
.snapshots(modelRepo.getSnapshots() != null ? convertRepositoryPolicy(modelRepo.getSnapshots()) : null)
|
||||
.releases(modelRepo.getReleases() != null ? convertRepositoryPolicy(modelRepo.getReleases()) : null)
|
||||
.build();
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modelPolicy
|
||||
* @return a RepositoryPolicy
|
||||
*/
|
||||
private static RepositoryPolicy convertRepositoryPolicy(org.apache.maven.api.model.RepositoryPolicy modelPolicy) {
|
||||
RepositoryPolicy policy = RepositoryPolicy.newBuilder()
|
||||
.enabled(modelPolicy.isEnabled())
|
||||
.updatePolicy(modelPolicy.getUpdatePolicy())
|
||||
.checksumPolicy(modelPolicy.getChecksumPolicy())
|
||||
.build();
|
||||
return policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param settings could be null
|
||||
* @return a new instance of settings or null if settings was null.
|
||||
*/
|
||||
public static org.apache.maven.settings.Settings copySettings(org.apache.maven.settings.Settings settings) {
|
||||
if (settings == null) {
|
||||
return null;
|
||||
}
|
||||
return new org.apache.maven.settings.Settings(settings.getDelegate());
|
||||
}
|
||||
}
|
@@ -18,10 +18,9 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.impl;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
import org.mvndaemon.mvnd.cache.CacheRecord;
|
||||
|
@@ -18,21 +18,20 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.DefaultExtensionRealmCache;
|
||||
import org.apache.maven.project.ExtensionDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
|
||||
|
@@ -18,18 +18,17 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.DefaultPluginArtifactsCache;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
|
||||
|
@@ -18,24 +18,26 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.plugin.*;
|
||||
import org.apache.maven.plugin.DefaultPluginDescriptorCache;
|
||||
import org.apache.maven.plugin.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||
import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
import org.mvndaemon.mvnd.cache.CacheRecord;
|
||||
|
@@ -18,14 +18,14 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.plugin.DefaultPluginRealmCache;
|
||||
import org.apache.maven.plugin.PluginContainerException;
|
||||
@@ -33,7 +33,6 @@ import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
|
||||
|
@@ -18,10 +18,6 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
@@ -35,6 +31,10 @@ import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Priority;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.lifecycle.LifecycleExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
@@ -43,7 +43,6 @@ import org.eclipse.aether.RepositorySystemSession;
|
||||
import org.eclipse.aether.repository.LocalRepository;
|
||||
import org.eclipse.aether.repository.RemoteRepository;
|
||||
import org.eclipse.aether.repository.WorkspaceRepository;
|
||||
import org.eclipse.sisu.Priority;
|
||||
import org.mvndaemon.mvnd.cache.Cache;
|
||||
import org.mvndaemon.mvnd.cache.CacheFactory;
|
||||
|
||||
|
@@ -18,10 +18,6 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.cache.invalidating;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.FileSystems;
|
||||
@@ -31,12 +27,15 @@ import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.di.Inject;
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.api.di.Typed;
|
||||
import org.apache.maven.eventspy.AbstractEventSpy;
|
||||
import org.apache.maven.eventspy.EventSpy;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionResult;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.eclipse.sisu.Typed;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@@ -37,13 +37,12 @@ package org.mvndaemon.mvnd.execution;
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.execution.BuildFailure;
|
||||
import org.apache.maven.execution.BuildSuccess;
|
||||
import org.apache.maven.execution.MavenExecutionResult;
|
||||
|
@@ -37,9 +37,6 @@ package org.mvndaemon.mvnd.execution;
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
@@ -49,6 +46,8 @@ import java.nio.file.Paths;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.api.di.Named;
|
||||
import org.apache.maven.api.di.Singleton;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.slf4j.Logger;
|
||||
|
@@ -40,7 +40,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Named
|
||||
@Priority(10)
|
||||
@Priority(20)
|
||||
@Typed({Prompter.class, InputHandler.class, OutputHandler.class})
|
||||
public class DaemonPrompter extends AbstractInputHandler implements Prompter, InputHandler, OutputHandler {
|
||||
|
||||
|
Reference in New Issue
Block a user