mirror of https://github.com/apache/maven.git
Restore compatibility on SettingsBuilder, ToolchainsBuilder and MojoDescriptorCreator (#820)
This commit is contained in:
parent
3bc2cf6a7a
commit
3f90e7028e
|
@ -86,8 +86,8 @@ public class DefaultWagonManager
|
|||
if ( id.equalsIgnoreCase( server.getId() ) )
|
||||
{
|
||||
SettingsDecryptionResult result = settingsDecrypter.decrypt(
|
||||
new DefaultSettingsDecryptionRequest( server.getDelegate() ) );
|
||||
server = new Server( result.getServer() );
|
||||
new DefaultSettingsDecryptionRequest( server ) );
|
||||
server = result.getServer();
|
||||
|
||||
AuthenticationInfo authInfo = new AuthenticationInfo();
|
||||
authInfo.setUserName( server.getUsername() );
|
||||
|
@ -125,8 +125,8 @@ public class DefaultWagonManager
|
|||
if ( proxy.isActive() && protocol.equalsIgnoreCase( proxy.getProtocol() ) )
|
||||
{
|
||||
SettingsDecryptionResult result = settingsDecrypter.decrypt(
|
||||
new DefaultSettingsDecryptionRequest( proxy.getDelegate() ) );
|
||||
proxy = new Proxy( result.getProxy() );
|
||||
new DefaultSettingsDecryptionRequest( proxy ) );
|
||||
proxy = result.getProxy();
|
||||
|
||||
ProxyInfo proxyInfo = new ProxyInfo();
|
||||
proxyInfo.setHost( proxy.getHost() );
|
||||
|
|
|
@ -563,9 +563,9 @@ public class LegacyRepositorySystem
|
|||
|
||||
if ( server != null )
|
||||
{
|
||||
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( server.getDelegate() );
|
||||
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( server );
|
||||
SettingsDecryptionResult result = settingsDecrypter.decrypt( request );
|
||||
server = new Server( result.getServer() );
|
||||
server = result.getServer();
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
|
@ -670,9 +670,9 @@ public class LegacyRepositorySystem
|
|||
|
||||
if ( proxy != null )
|
||||
{
|
||||
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( proxy.getDelegate() );
|
||||
SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest( proxy );
|
||||
SettingsDecryptionResult result = settingsDecrypter.decrypt( request );
|
||||
proxy = new org.apache.maven.settings.Proxy( result.getProxy() );
|
||||
proxy = result.getProxy();
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
|
|
|
@ -194,8 +194,8 @@ public class DefaultRepositorySystemSessionFactory
|
|||
request.getWorkspaceReader() != null ? request.getWorkspaceReader() : workspaceRepository );
|
||||
|
||||
DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest();
|
||||
decrypt.setProxies( Proxy.proxyToApiV4( request.getProxies() ) );
|
||||
decrypt.setServers( Server.serverToApiV4( request.getServers() ) );
|
||||
decrypt.setProxies( request.getProxies() );
|
||||
decrypt.setServers( request.getServers() );
|
||||
SettingsDecryptionResult decrypted = settingsDecrypter.decrypt( decrypt );
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
|
@ -215,7 +215,7 @@ public class DefaultRepositorySystemSessionFactory
|
|||
session.setMirrorSelector( mirrorSelector );
|
||||
|
||||
DefaultProxySelector proxySelector = new DefaultProxySelector();
|
||||
for ( org.apache.maven.api.settings.Proxy proxy : decrypted.getProxies() )
|
||||
for ( Proxy proxy : decrypted.getProxies() )
|
||||
{
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() );
|
||||
|
@ -226,7 +226,7 @@ public class DefaultRepositorySystemSessionFactory
|
|||
session.setProxySelector( proxySelector );
|
||||
|
||||
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
|
||||
for ( org.apache.maven.api.settings.Server server : decrypted.getServers() )
|
||||
for ( Server server : decrypted.getServers() )
|
||||
{
|
||||
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
|
||||
authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() );
|
||||
|
@ -235,7 +235,7 @@ public class DefaultRepositorySystemSessionFactory
|
|||
|
||||
if ( server.getConfiguration() != null )
|
||||
{
|
||||
Dom dom = server.getConfiguration();
|
||||
Dom dom = ( ( org.codehaus.plexus.util.xml.Xpp3Dom ) server.getConfiguration() ).getDom();
|
||||
List<Dom> children = dom.getChildren().stream()
|
||||
.filter( c -> !"wagonProvider".equals( c.getName() ) )
|
||||
.collect( Collectors.toList() );
|
||||
|
|
|
@ -371,9 +371,9 @@ public class DefaultLifecycleExecutionPlanCalculator
|
|||
mojoExecution.setConfiguration( finalConfiguration );
|
||||
}
|
||||
|
||||
private Xpp3Dom getMojoConfiguration( MojoDescriptor mojoDescriptor )
|
||||
private Dom getMojoConfiguration( MojoDescriptor mojoDescriptor )
|
||||
{
|
||||
return MojoDescriptorCreator.convert( mojoDescriptor );
|
||||
return MojoDescriptorCreator.convert( mojoDescriptor ).getDom();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,7 @@ public class MojoDescriptorCreator
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Xpp3Dom convert( MojoDescriptor mojoDescriptor )
|
||||
public static org.codehaus.plexus.util.xml.Xpp3Dom convert( MojoDescriptor mojoDescriptor )
|
||||
{
|
||||
PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class MojoDescriptorCreator
|
|||
}
|
||||
|
||||
Xpp3Dom dom = new Xpp3Dom( "configuration", null, null, children, null );
|
||||
return dom;
|
||||
return new org.codehaus.plexus.util.xml.Xpp3Dom( dom );
|
||||
}
|
||||
|
||||
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.inject.Inject;
|
|||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.properties.internal.SystemProperties;
|
||||
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.apache.maven.settings;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
|
|||
import org.apache.maven.rtinfo.RuntimeInformation;
|
||||
import org.apache.maven.session.scope.internal.SessionScope;
|
||||
import org.apache.maven.toolchain.DefaultToolchainManagerPrivate;
|
||||
import org.apache.maven.toolchain.building.ToolchainsBuilder;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.testing.PlexusTest;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
|
|
|
@ -291,7 +291,7 @@ public class LifecycleExecutorTest
|
|||
MojoDescriptor mojoDescriptor =
|
||||
mojoDescriptorCreator.getMojoDescriptor( "org.apache.maven.its.plugins:maven-it-plugin:0.1:java", session,
|
||||
session.getCurrentProject() );
|
||||
Dom dom = MojoDescriptorCreator.convert( mojoDescriptor );
|
||||
Dom dom = MojoDescriptorCreator.convert( mojoDescriptor ).getDom();
|
||||
System.out.println( dom );
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ import org.apache.maven.shared.utils.logging.MessageUtils;
|
|||
import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest;
|
||||
import org.apache.maven.toolchain.building.ToolchainsBuilder;
|
||||
import org.apache.maven.toolchain.building.ToolchainsBuildingResult;
|
||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||
import org.codehaus.plexus.ContainerConfiguration;
|
||||
import org.codehaus.plexus.DefaultContainerConfiguration;
|
||||
import org.codehaus.plexus.DefaultPlexusContainer;
|
||||
|
@ -1335,7 +1334,7 @@ public class MavenCli
|
|||
eventSpyDispatcher.onEvent( toolchainsResult );
|
||||
|
||||
executionRequestPopulator.populateFromToolchains( cliRequest.request,
|
||||
new PersistedToolchains( toolchainsResult.getEffectiveToolchains() ) );
|
||||
toolchainsResult.getEffectiveToolchains() );
|
||||
|
||||
if ( !toolchainsResult.getProblems().isEmpty() && slf4jLogger.isWarnEnabled() )
|
||||
{
|
||||
|
|
|
@ -35,11 +35,12 @@ import org.apache.maven.cli.CLIManager;
|
|||
import org.apache.maven.cli.CliRequest;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.execution.MavenExecutionRequestPopulationException;
|
||||
import org.apache.maven.api.settings.Mirror;
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Repository;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.settings.Mirror;
|
||||
import org.apache.maven.settings.Profile;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Repository;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.settings.SettingsUtils;
|
||||
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
|
||||
import org.apache.maven.settings.building.SettingsBuilder;
|
||||
|
@ -188,7 +189,7 @@ public class SettingsXmlConfigurationProcessor
|
|||
|
||||
for ( Server server : settings.getServers() )
|
||||
{
|
||||
request.addServer( new org.apache.maven.settings.Server( server ) );
|
||||
request.addServer( server );
|
||||
}
|
||||
|
||||
// <proxies>
|
||||
|
@ -210,7 +211,7 @@ public class SettingsXmlConfigurationProcessor
|
|||
continue;
|
||||
}
|
||||
|
||||
request.addProxy( new org.apache.maven.settings.Proxy( proxy ) );
|
||||
request.addProxy( proxy );
|
||||
}
|
||||
|
||||
// <mirrors>
|
||||
|
@ -223,14 +224,14 @@ public class SettingsXmlConfigurationProcessor
|
|||
|
||||
for ( Mirror mirror : settings.getMirrors() )
|
||||
{
|
||||
request.addMirror( new org.apache.maven.settings.Mirror( mirror ) );
|
||||
request.addMirror( mirror );
|
||||
}
|
||||
|
||||
request.setActiveProfiles( settings.getActiveProfiles() );
|
||||
|
||||
for ( org.apache.maven.api.settings.Profile rawProfile : settings.getProfiles() )
|
||||
for ( Profile rawProfile : settings.getProfiles() )
|
||||
{
|
||||
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
|
||||
request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile.getDelegate() ) );
|
||||
|
||||
if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )
|
||||
{
|
||||
|
@ -239,8 +240,8 @@ public class SettingsXmlConfigurationProcessor
|
|||
{
|
||||
try
|
||||
{
|
||||
request.addRemoteRepository( MavenRepositorySystem.buildArtifactRepository(
|
||||
new org.apache.maven.settings.Repository( remoteRepository ) ) );
|
||||
request.addRemoteRepository(
|
||||
MavenRepositorySystem.buildArtifactRepository( remoteRepository ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
|
@ -254,7 +255,7 @@ public class SettingsXmlConfigurationProcessor
|
|||
try
|
||||
{
|
||||
request.addPluginArtifactRepository( MavenRepositorySystem.buildArtifactRepository(
|
||||
new org.apache.maven.settings.Repository( pluginRepository ) ) );
|
||||
pluginRepository ) );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ import javax.inject.Singleton;
|
|||
import org.apache.maven.building.FileSource;
|
||||
import org.apache.maven.building.Source;
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.api.settings.TrackableBase;
|
||||
import org.apache.maven.settings.TrackableBase;
|
||||
import org.apache.maven.settings.io.SettingsParseException;
|
||||
import org.apache.maven.settings.io.SettingsReader;
|
||||
import org.apache.maven.settings.io.SettingsWriter;
|
||||
|
@ -128,7 +128,8 @@ public class DefaultSettingsBuilder
|
|||
throw new SettingsBuildingException( problems.getProblems() );
|
||||
}
|
||||
|
||||
return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() );
|
||||
return new DefaultSettingsBuildingResult( new org.apache.maven.settings.Settings( userSettings ),
|
||||
problems.getProblems() );
|
||||
}
|
||||
|
||||
private boolean hasErrors( List<SettingsProblem> problems )
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.maven.settings.building;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
/**
|
||||
* Collects the output of the settings builder.
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.maven.settings.building;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
/**
|
||||
* Collects the output of the settings builder.
|
||||
|
|
|
@ -26,8 +26,8 @@ import javax.inject.Inject;
|
|||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.building.DefaultSettingsProblem;
|
||||
import org.apache.maven.settings.building.SettingsProblem;
|
||||
import org.apache.maven.settings.building.SettingsProblem.Severity;
|
||||
|
@ -61,9 +61,11 @@ public class DefaultSettingsDecrypter
|
|||
|
||||
for ( Server server : request.getServers() )
|
||||
{
|
||||
server = server.clone();
|
||||
|
||||
try
|
||||
{
|
||||
server = server.withPassword( decrypt( server.getPassword() ) );
|
||||
server.setPassword( decrypt( server.getPassword() ) );
|
||||
}
|
||||
catch ( SecDispatcherException e )
|
||||
{
|
||||
|
@ -73,7 +75,7 @@ public class DefaultSettingsDecrypter
|
|||
|
||||
try
|
||||
{
|
||||
server = server.withPassphrase( decrypt( server.getPassphrase() ) );
|
||||
server.setPassphrase( decrypt( server.getPassphrase() ) );
|
||||
}
|
||||
catch ( SecDispatcherException e )
|
||||
{
|
||||
|
@ -90,7 +92,7 @@ public class DefaultSettingsDecrypter
|
|||
{
|
||||
try
|
||||
{
|
||||
proxy = proxy.withPassword( decrypt( proxy.getPassword() ) );
|
||||
proxy.setPassword( decrypt( proxy.getPassword() ) );
|
||||
}
|
||||
catch ( SecDispatcherException e )
|
||||
{
|
||||
|
|
|
@ -23,9 +23,9 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.api.settings.Settings;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
/**
|
||||
* Collects parameters that control the decryption of settings.
|
||||
|
|
|
@ -22,8 +22,8 @@ package org.apache.maven.settings.crypto;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.building.SettingsProblem;
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,8 +21,8 @@ package org.apache.maven.settings.crypto;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
|
||||
/**
|
||||
* Collects parameters that control the decryption of settings.
|
||||
|
|
|
@ -21,8 +21,8 @@ package org.apache.maven.settings.crypto;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.api.settings.Proxy;
|
||||
import org.apache.maven.api.settings.Server;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
import org.apache.maven.settings.Server;
|
||||
import org.apache.maven.settings.building.SettingsProblem;
|
||||
|
||||
/**
|
||||
|
|
|
@ -88,8 +88,8 @@ public class DefaultToolchainsBuilder
|
|||
throw new ToolchainsBuildingException( problems.getProblems() );
|
||||
}
|
||||
|
||||
|
||||
return new DefaultToolchainsBuildingResult( merged, problems.getProblems() );
|
||||
return new DefaultToolchainsBuildingResult(
|
||||
new org.apache.maven.toolchain.model.PersistedToolchains( merged ), problems.getProblems() );
|
||||
}
|
||||
|
||||
private PersistedToolchains interpolate( PersistedToolchains toolchains, ProblemCollector problems )
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.maven.building.Problem;
|
||||
import org.apache.maven.api.toolchain.PersistedToolchains;
|
||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||
|
||||
/**
|
||||
* Holds the result of the merged toolchains and holds the problems during this build, if any.
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.maven.toolchain.building;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.maven.building.Problem;
|
||||
import org.apache.maven.api.toolchain.PersistedToolchains;
|
||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||
|
||||
/**
|
||||
* Collects the output of the toolchains builder.
|
||||
|
|
|
@ -39,7 +39,6 @@ import java.io.InputStream;
|
|||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
@ -240,7 +239,8 @@ public class DefaultToolchainsBuilderTest
|
|||
ToolchainsBuildingResult result = toolchainBuilder.build( request );
|
||||
String interpolatedValue = "testValue";
|
||||
assertEquals(interpolatedValue, result.getEffectiveToolchains().getToolchains().get(0).getProvides().get( "key" ) );
|
||||
Xpp3Dom toolchainConfiguration = (Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration();
|
||||
org.codehaus.plexus.util.xml.Xpp3Dom toolchainConfiguration =
|
||||
(org.codehaus.plexus.util.xml.Xpp3Dom) result.getEffectiveToolchains().getToolchains().get(0).getConfiguration();
|
||||
assertEquals(interpolatedValue, toolchainConfiguration.getChild("jdkHome").getValue());
|
||||
assertNotNull( result.getProblems() );
|
||||
assertEquals( 0, result.getProblems().size() );
|
||||
|
|
Loading…
Reference in New Issue