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. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/103f6418 Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/103f6418 Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/103f6418 Branch: refs/heads/master Commit: 103f6418cf201e84cff8bca46ce6c26453b84a02 Parents: d6e9226 Author: Jason van Zyl <ja...@tesla.io> Authored: Mon Feb 9 02:01:54 2015 -0500 Committer: Jason van Zyl <ja...@tesla.io> Committed: Mon Feb 9 02:28:35 2015 -0500 ---------------------------------------------------------------------- .../apache/maven/execution/MavenSession.java | 267 ++++++++++--------- 1 file changed, 138 insertions(+), 129 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/103f6418/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java index 972ebd6..aaa8e66 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java @@ -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]*/ + }