Experimenting with Munge to chop out deprecated code for a Maven 4.x codebase

I will try and collect all deprecated code at the bottom of classes with Munge markers and
use this in conjunction with a definitive list of classes to be purged in order to use
one code line to safely experiment with Maven 4.x.
This commit is contained in:
Jason van Zyl 2015-02-09 02:01:54 -05:00
parent d6e9226b60
commit 103f6418cf
1 changed files with 138 additions and 129 deletions

View File

@ -44,16 +44,12 @@ import org.eclipse.aether.RepositorySystemSession;
public class MavenSession
implements Cloneable
{
private PlexusContainer container;
private MavenExecutionRequest request;
private MavenExecutionResult result;
private RepositorySystemSession repositorySession;
private final Settings settings;
private Properties executionProperties;
private MavenProject currentProject;
@ -80,59 +76,6 @@ public class MavenSession
private final Map<String, Map<String, Map<String, Object>>> pluginContextsByProjectAndPluginKey =
new ConcurrentHashMap<String, Map<String, Map<String, Object>>>();
@Deprecated
public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
MavenProject project )
{
this( container, request, result, Arrays.asList( new MavenProject[]{project} ) );
}
@Deprecated
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
String executionRootDir, Properties executionProperties, Date startTime )
{
this( container, settings, localRepository, eventDispatcher, unused, goals, executionRootDir,
executionProperties, null, startTime );
}
@Deprecated
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
String executionRootDir, Properties executionProperties, Properties userProperties,
Date startTime )
{
this.container = container;
this.settings = settings;
this.executionProperties = executionProperties;
this.request = new DefaultMavenExecutionRequest();
this.request.setUserProperties( userProperties );
this.request.setLocalRepository( localRepository );
this.request.setGoals( goals );
this.request.setBaseDirectory( ( executionRootDir != null ) ? new File( executionRootDir ) : null );
this.request.setStartTime( startTime );
}
@Deprecated
public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
List<MavenProject> projects )
{
this.container = container;
this.request = request;
this.result = result;
this.settings = new SettingsAdapter( request );
setProjects( projects );
}
public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession, MavenExecutionRequest request,
MavenExecutionResult result )
{
this.container = container;
this.request = request;
this.result = result;
this.settings = new SettingsAdapter( request );
this.repositorySession = repositorySession;
}
public void setProjects( List<MavenProject> projects )
{
@ -157,40 +100,6 @@ public class MavenSession
this.projects = projects;
}
@Deprecated
public PlexusContainer getContainer()
{
return container;
}
@Deprecated
public Object lookup( String role )
throws ComponentLookupException
{
return container.lookup( role );
}
@Deprecated
public Object lookup( String role, String roleHint )
throws ComponentLookupException
{
return container.lookup( role, roleHint );
}
@Deprecated
public List<Object> lookupList( String role )
throws ComponentLookupException
{
return container.lookupList( role );
}
@Deprecated
public Map<String, Object> lookupMap( String role )
throws ComponentLookupException
{
return container.lookupMap( role );
}
public ArtifactRepository getLocalRepository()
{
return request.getLocalRepository();
@ -224,22 +133,6 @@ public class MavenSession
return request.getSystemProperties();
}
/**
* @deprecated Use either {@link #getUserProperties()} or {@link #getSystemProperties()}.
*/
@Deprecated
public Properties getExecutionProperties()
{
if ( executionProperties == null )
{
executionProperties = new Properties();
executionProperties.putAll( request.getSystemProperties() );
executionProperties.putAll( request.getUserProperties() );
}
return executionProperties;
}
public Settings getSettings()
{
return settings;
@ -261,12 +154,6 @@ public class MavenSession
return request.getBaseDirectory();
}
@Deprecated
public boolean isUsingPOMsFromFilesystem()
{
return request.isProjectPresent();
}
public MavenExecutionRequest getRequest()
{
return request;
@ -364,12 +251,6 @@ public class MavenSession
}
}
@Deprecated
public EventDispatcher getEventDispatcher()
{
return null;
}
public Date getStartTime()
{
return request.getStartTime();
@ -390,16 +271,6 @@ public class MavenSession
return repositorySession;
}
@Deprecated
//
// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
// this here, possibly indefinitely.
//
public RepositoryCache getRepositoryCache()
{
return null;
}
private Map<String, MavenProject> projectMap;
public void setProjectMap( Map<String, MavenProject> projectMap )
@ -424,5 +295,143 @@ public class MavenSession
this.allProjects = allProjects;
}
/*if_not[MAVEN4]*/
//
// Deprecated
//
private PlexusContainer container;
private final Settings settings;
@Deprecated
public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession, MavenExecutionRequest request,
MavenExecutionResult result )
{
this.container = container;
this.request = request;
this.result = result;
this.settings = new SettingsAdapter( request );
this.repositorySession = repositorySession;
}
@Deprecated
public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
MavenProject project )
{
this( container, request, result, Arrays.asList( new MavenProject[]{project} ) );
}
@Deprecated
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
String executionRootDir, Properties executionProperties, Date startTime )
{
this( container, settings, localRepository, eventDispatcher, unused, goals, executionRootDir,
executionProperties, null, startTime );
}
@Deprecated
public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
String executionRootDir, Properties executionProperties, Properties userProperties,
Date startTime )
{
this.container = container;
this.settings = settings;
this.executionProperties = executionProperties;
this.request = new DefaultMavenExecutionRequest();
this.request.setUserProperties( userProperties );
this.request.setLocalRepository( localRepository );
this.request.setGoals( goals );
this.request.setBaseDirectory( ( executionRootDir != null ) ? new File( executionRootDir ) : null );
this.request.setStartTime( startTime );
}
@Deprecated
public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
List<MavenProject> projects )
{
this.container = container;
this.request = request;
this.result = result;
this.settings = new SettingsAdapter( request );
setProjects( projects );
}
@Deprecated
//
// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
// this here, possibly indefinitely.
//
public RepositoryCache getRepositoryCache()
{
return null;
}
@Deprecated
public EventDispatcher getEventDispatcher()
{
return null;
}
@Deprecated
public boolean isUsingPOMsFromFilesystem()
{
return request.isProjectPresent();
}
/**
* @deprecated Use either {@link #getUserProperties()} or {@link #getSystemProperties()}.
*/
@Deprecated
public Properties getExecutionProperties()
{
if ( executionProperties == null )
{
executionProperties = new Properties();
executionProperties.putAll( request.getSystemProperties() );
executionProperties.putAll( request.getUserProperties() );
}
return executionProperties;
}
@Deprecated
public PlexusContainer getContainer()
{
return container;
}
@Deprecated
public Object lookup( String role )
throws ComponentLookupException
{
return container.lookup( role );
}
@Deprecated
public Object lookup( String role, String roleHint )
throws ComponentLookupException
{
return container.lookup( role, roleHint );
}
@Deprecated
public List<Object> lookupList( String role )
throws ComponentLookupException
{
return container.lookupList( role );
}
@Deprecated
public Map<String, Object> lookupMap( String role )
throws ComponentLookupException
{
return container.lookupMap( role );
}
/*end[MAVEN4]*/
}