You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/05/24 15:25:15 UTC

[maven-site-plugin] 01/01: [MSITE-757] More cleanup after upgrade to Maven 3.0.5

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MSITE-757
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git

commit 8d97d9ae5f01b7da6f1705c5fbcfa7c1153948da
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun May 24 17:24:19 2020 +0200

    [MSITE-757] More cleanup after upgrade to Maven 3.0.5
---
 pom.xml                                            |   2 +-
 .../maven/plugins/site/AbstractSiteMojo.java       |  28 +-
 .../plugins/site/deploy/AbstractDeployMojo.java    |   5 +-
 .../site/deploy/wagon/BugFixedRepository.java      | 306 -------------
 .../maven/plugins/site/deploy/wagon/PathUtils.java | 501 ---------------------
 .../site/render/AbstractSiteRenderingMojo.java     |  54 +--
 6 files changed, 29 insertions(+), 867 deletions(-)

diff --git a/pom.xml b/pom.xml
index 842e6fa..f962378 100644
--- a/pom.xml
+++ b/pom.xml
@@ -195,7 +195,7 @@ under the License.
   </distributionManagement>
 
   <properties>
-    <mavenVersion>3.0</mavenVersion>
+    <mavenVersion>3.0.5</mavenVersion>
     <javaVersion>7</javaVersion>
     <!-- for dependencies -->
     <doxiaVersion>1.9.1</doxiaVersion>
diff --git a/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java b/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
index b759cfd..15a18ed 100644
--- a/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
@@ -25,13 +25,11 @@ import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.rtinfo.RuntimeInformation;
 import org.codehaus.plexus.i18n.I18N;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.util.List;
 import java.util.Locale;
-import java.util.Properties;
 
 /**
  * Base class for site mojos.
@@ -88,25 +86,13 @@ public abstract class AbstractSiteMojo
     @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
     protected List<MavenProject> reactorProjects;
 
-    protected static String getMavenVersion()
-    {
-        // This relies on the fact that MavenProject is the in core classloader
-        // and that the core classloader is for the maven-core artifact
-        // and that should have a pom.properties file
-        // if this ever changes, we will have to revisit this code.
-        final Properties properties = new Properties();
-        final String corePomProperties = "META-INF/maven/org.apache.maven/maven-core/pom.properties";
-
-        try ( InputStream in = MavenProject.class.getClassLoader().getResourceAsStream( corePomProperties ) )
-        {
-            properties.load( in );
-        }
-        catch ( IOException ioe )
-        {
-            return "";
-        }
+    @Component
+    protected RuntimeInformation runtimeInformation;
 
-        return properties.getProperty( "version" ).trim();
+    @Deprecated
+    protected String getMavenVersion()
+    {
+        return runtimeInformation.getMavenVersion();
     }
 
     protected List<Locale> getLocales()
diff --git a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
index 4e2c5ec..ae6ae15 100644
--- a/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/deploy/AbstractDeployMojo.java
@@ -30,7 +30,6 @@ import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.site.AbstractSiteMojo;
-import org.apache.maven.plugins.site.deploy.wagon.BugFixedRepository;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Proxy;
 import org.apache.maven.settings.Server;
@@ -129,7 +128,7 @@ public abstract class AbstractDeployMojo
     /**
      */
     @Component
-    private WagonManager wagonManager;
+    private WagonManager wagonManager; // maven-compat
 
     /**
      * The current user system settings for use in Maven.
@@ -167,7 +166,7 @@ public abstract class AbstractDeployMojo
             return;
         }
 
-        deployTo( new BugFixedRepository( getDeploySite().getId(), getDeploySite().getUrl() ) );
+        deployTo( new Repository( getDeploySite().getId(), getDeploySite().getUrl() ) );
     }
 
     /**
diff --git a/src/main/java/org/apache/maven/plugins/site/deploy/wagon/BugFixedRepository.java b/src/main/java/org/apache/maven/plugins/site/deploy/wagon/BugFixedRepository.java
deleted file mode 100644
index 4290299..0000000
--- a/src/main/java/org/apache/maven/plugins/site/deploy/wagon/BugFixedRepository.java
+++ /dev/null
@@ -1,306 +0,0 @@
-package org.apache.maven.plugins.site.deploy.wagon;
-
-/*
- * 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.
- */
-
-import org.apache.maven.wagon.WagonConstants;
-import org.apache.maven.wagon.repository.RepositoryPermissions;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.util.Properties;
-
-/**
- * This class is an abstraction of the location from/to resources
- * can be transfered.
- *
- * <strong>Note: </strong> This is a copy of a file from Wagon. It was copied here to be able to work around WAGON-307.
- * This class can be removed when the prerequisite Maven version uses wagon-provider-api:1.0-beta-7,
- * ie Maven &gt;= 3.0.1.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- * @todo [BP] some things are specific to certain wagons (eg key stuff in authInfo, permissions)
- */
-public class BugFixedRepository
-    extends org.apache.maven.wagon.repository.Repository
-{
-    private static final long serialVersionUID = 1312227676322136247L;
-
-    private String id;
-
-    private String name;
-
-    private String host;
-
-    private int port = WagonConstants.UNKNOWN_PORT;
-
-    private String basedir;
-
-    private String protocol;
-
-    private String url;
-
-    private RepositoryPermissions permissions;
-
-    /**
-     * Properties influencing wagon behaviour
-     * which are very specific to particular wagon.
-     */
-    private Properties parameters = new Properties();
-
-    // Username/password are sometimes encoded in the URL
-    private String username = null;
-
-    private String password = null;
-
-    public BugFixedRepository( String id, String url )
-    {
-        if ( id == null )
-        {
-            throw new NullPointerException( "id can not be null" );
-        }
-        
-        setId( id );
-
-        if ( url == null )
-        {
-            throw new NullPointerException( "url can not be null" );
-        }
-        
-        setUrl( url );
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    /**
-     * Retrieve the base directory of the repository. This is derived from the full repository URL, and
-     * contains the entire path component.
-     * 
-     * @return the base directory
-     */
-    public String getBasedir()
-    {
-        return basedir;
-    }
-
-    public void setBasedir( String basedir )
-    {
-        this.basedir = basedir;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public int getPort()
-    {
-        return port;
-    }
-
-    public void setPort( int port )
-    {
-        this.port = port;
-    }
-
-    public void setUrl( String url )
-    {
-        this.url = url;
-
-        // TODO [BP]: refactor out the PathUtils URL stuff into a class like java.net.URL, so you only parse once
-        //  can't use URL class as is because it won't recognise our protocols, though perhaps we could attempt to
-        //  register handlers for scp, etc?
-
-        this.protocol = PathUtils.protocol( url );
-
-        this.host = PathUtils.host( url );
-
-        this.port = PathUtils.port( url );
-
-        this.basedir = PathUtils.basedir( url );
-
-        String username = PathUtils.user( url );
-        this.username = username;
-
-        if ( username != null )
-        {
-            String password = PathUtils.password( url );
-
-            if ( password != null )
-            {
-                this.password = password;
-
-                username += ":" + password;
-            }
-
-            username += "@";
-
-            int index = url.indexOf( username );
-            this.url = url.substring( 0, index ) + url.substring( index + username.length() );
-        }
-    }
-
-    public String getUrl()
-    {
-        if ( url != null )
-        {
-            return url;
-        }
-
-        StringBuilder sb = new StringBuilder();
-
-        sb.append( protocol );
-
-        sb.append( "://" );
-
-        sb.append( host );
-
-        if ( port != WagonConstants.UNKNOWN_PORT )
-        {
-            sb.append( ":" );
-
-            sb.append( port );
-        }
-
-        sb.append( basedir );
-
-        return sb.toString();
-    }
-
-    public String getHost()
-    {
-        if ( host == null )
-        {
-            return "localhost";
-        }
-        return host;
-    }
-
-    public String getName()
-    {
-        if ( name == null )
-        {
-            return getId();
-        }
-        return name;
-    }
-
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append( "Repository[" );
-
-        if ( StringUtils.isNotEmpty( getName() ) )
-        {
-            sb.append( getName() ).append( "|" );
-        }
-
-        sb.append( getUrl() );
-        sb.append( "]" );
-
-        return sb.toString();
-    }
-
-    public String getProtocol()
-    {
-        return protocol;
-    }
-
-    public RepositoryPermissions getPermissions()
-    {
-        return permissions;
-    }
-
-    public void setPermissions( RepositoryPermissions permissions )
-    {
-        this.permissions = permissions;
-    }
-
-    public String getParameter( String key )
-    {
-        return parameters.getProperty( key );
-    }
-
-    public void setParameters( Properties parameters )
-    {
-        this.parameters = parameters;
-    }
-
-    public int hashCode()
-    {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ( ( id == null ) ? 0 : id.hashCode() );
-        return result;
-    }
-
-    public boolean equals( Object obj )
-    {
-        if ( this == obj )
-        {
-            return true;
-        }
-        if ( obj == null )
-        {
-            return false;
-        }
-        if ( getClass() != obj.getClass() )
-        {
-            return false;
-        }
-        final BugFixedRepository other = (BugFixedRepository) obj;
-        if ( id == null )
-        {
-            if ( other.id != null )
-            {
-                return false;
-            }
-        }
-        else if ( !id.equals( other.id ) )
-        {
-            return false;
-        }
-        return true;
-    }
-
-    public String getUsername()
-    {
-        return username;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setProtocol( String protocol )
-    {
-        this.protocol = protocol;
-    }
-
-}
diff --git a/src/main/java/org/apache/maven/plugins/site/deploy/wagon/PathUtils.java b/src/main/java/org/apache/maven/plugins/site/deploy/wagon/PathUtils.java
deleted file mode 100644
index 089210f..0000000
--- a/src/main/java/org/apache/maven/plugins/site/deploy/wagon/PathUtils.java
+++ /dev/null
@@ -1,501 +0,0 @@
-package org.apache.maven.plugins.site.deploy.wagon;
-
-/*
- * 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.
- */
-
-import org.apache.maven.wagon.WagonConstants;
-
-import java.io.File;
-import java.util.StringTokenizer;
-
-/**
- * Various path (URL) manipulation routines.
- *
- * <strong>Note: </strong> This is a copy of a file from Wagon. It was copied here to be able to work around WAGON-307.
- * This class can be removed when the prerequisite Maven version uses wagon-provider-api:1.0-beta-7,
- * ie Maven &gt;= 3.0.1.
- *
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public final class PathUtils
-{
-    private PathUtils()
-    {
-        // no op
-    }
-    
-    /**
-     * Returns the directory path portion of a file specification string.
-     * Matches the equally named unix command.
-     *
-     * @return The directory portion excluding the ending file separator.
-     */
-    public static String dirname( final String path )
-    {
-        final int i = path.lastIndexOf( '/' );
-
-        return ( ( i >= 0 ) ? path.substring( 0, i ) : "" );
-    }
-
-    /**
-     * Returns the filename portion of a file specification string.
-     *
-     * @return The filename string with extension.
-     */
-    public static String filename( final String path )
-    {
-        final int i = path.lastIndexOf( '/' );
-        return ( ( i >= 0 ) ? path.substring( i + 1 ) : path );
-    }
-
-    public static String[] dirnames( final String path )
-    {
-        final String dirname = PathUtils.dirname( path );
-        return split( dirname, "/", -1 );
-
-    }
-
-    private static String[] split( final String str, final String separator, final int max )
-    {
-        final StringTokenizer tok;
-
-        if ( separator == null )
-        {
-            // Null separator means we're using StringTokenizer's default
-            // delimiter, which comprises all whitespace characters.
-            tok = new StringTokenizer( str );
-        }
-        else
-        {
-            tok = new StringTokenizer( str, separator );
-        }
-
-        int listSize = tok.countTokens();
-
-        if ( max > 0 && listSize > max )
-        {
-            listSize = max;
-        }
-
-        final String[] list = new String[listSize];
-
-        int i = 0;
-
-        int lastTokenBegin;
-        int lastTokenEnd = 0;
-
-        while ( tok.hasMoreTokens() )
-        {
-            if ( max > 0 && i == listSize - 1 )
-            {
-                // In the situation where we hit the max yet have
-                // tokens left over in our input, the last list
-                // element gets all remaining text.
-                final String endToken = tok.nextToken();
-
-                lastTokenBegin = str.indexOf( endToken, lastTokenEnd );
-
-                list[i] = str.substring( lastTokenBegin );
-
-                break;
-
-            }
-            else
-            {
-                list[i] = tok.nextToken();
-
-                lastTokenBegin = str.indexOf( list[i], lastTokenEnd );
-
-                lastTokenEnd = lastTokenBegin + list[i].length();
-            }
-
-            i++;
-        }
-        return list;
-    }
-
-    /**
-     * Return the host name (Removes protocol and path from the URL) E.g: for input
-     * <code>http://www.codehause.org</code> this method will return <code>www.apache.org</code>
-     *
-     * @param url the url
-     * @return the host name
-     */
-    public static String host( final String url )
-    {
-        String authorization = authorization( url );
-        int index = authorization.indexOf( '@' );
-        if ( index >= 0 )
-        {
-            return authorization.substring( index + 1 );
-        }
-        else
-        {
-            return authorization;
-        }
-    }
-
-    /**
-     * This was changed from private to package local so that it can be unit tested.
-     */
-    static String authorization( final String url )
-    {
-        if ( url == null )
-        {
-            return "localhost";
-        }
-
-        final String protocol = PathUtils.protocol( url );
-
-        if ( protocol == null || protocol.equalsIgnoreCase( "file" ) )
-        {
-            return "localhost";
-        }
-
-        String host = url;
-        if ( protocol.equalsIgnoreCase( "scm" ) )
-        {
-            // skip over type
-            host = host.substring( host.indexOf( ':', 4 ) + 1 ).trim();
-        }
-
-        // skip over protocol
-        host = host.substring( host.indexOf( ':' ) + 1 ).trim();
-        if ( host.startsWith( "//" ) )
-        {
-            host = host.substring( 2 );
-        }
-
-        int pos = host.indexOf( '/' );
-
-        if ( pos > 0 )
-        {
-            host = host.substring( 0, pos );
-        }
-
-        pos = host.indexOf( '@' );
-
-        if ( pos > 0 )
-        {
-            pos = host.indexOf( ':', pos );
-        }
-        else
-        {
-            pos = host.indexOf( ':' );
-        }
-
-        if ( pos > 0 )
-        {
-            host = host.substring( 0, pos );
-        }
-        return host;
-    }
-
-    /**
-     * /**
-     * Return the protocol name.
-     * <br/>
-     * E.g: for input
-     * <code>http://www.codehause.org</code> this method will return <code>http</code>
-     *
-     * @param url the url
-     * @return the host name
-     */
-    public static String protocol( final String url )
-    {
-        final int pos = url.indexOf( ':' );
-
-        if ( pos == -1 )
-        {
-            return "";
-        }
-        return url.substring( 0, pos ).trim();
-    }
-
-    /**
-     * @param url
-     * @return the port or {@link WagonConstants#UNKNOWN_PORT} if not existent
-     */
-    public static int port( String url )
-    {
-
-        final String protocol = PathUtils.protocol( url );
-
-        if ( protocol == null || protocol.equalsIgnoreCase( "file" ) )
-        {
-            return WagonConstants.UNKNOWN_PORT;
-        }
-
-        final String authorization = PathUtils.authorization( url );
-
-        if ( authorization == null )
-        {
-            return WagonConstants.UNKNOWN_PORT;
-        }
-
-        if ( protocol.equalsIgnoreCase( "scm" ) )
-        {
-            // skip over type
-            url = url.substring( url.indexOf( ':', 4 ) + 1 ).trim();
-        }
-
-        if ( url.regionMatches( true, 0, "file:", 0, 5 ) || url.regionMatches( true, 0, "local:", 0, 6 ) )
-        {
-            return WagonConstants.UNKNOWN_PORT;
-        }
-
-        // skip over protocol
-        url = url.substring( url.indexOf( ':' ) + 1 ).trim();
-        if ( url.startsWith( "//" ) )
-        {
-            url = url.substring( 2 );
-        }
-
-        int start = authorization.length();
-
-        if ( url.length() > start && url.charAt( start ) == ':' )
-        {
-            int end = url.indexOf( '/', start );
-
-            if ( end == start + 1 )
-            {
-                // it is :/
-                return WagonConstants.UNKNOWN_PORT;
-            }
-
-            if ( end == -1 )
-            {
-                end = url.length();
-            }
-
-            return Integer.parseInt( url.substring( start + 1, end ) );
-        }
-        else
-        {
-            return WagonConstants.UNKNOWN_PORT;
-        }
-
-    }
-
-    /**
-     * Derive the path portion of the given URL.
-     * 
-     * @param url the repository URL
-     * @return the basedir of the repository
-     * @todo need to URL decode for spaces?
-     */
-    public static String basedir( String url )
-    {
-        String protocol = PathUtils.protocol( url );
-
-        String retValue = null;
-
-        if ( protocol.equalsIgnoreCase( "scm" ) )
-        {
-            // skip over SCM bits
-            if ( url.regionMatches( true, 0, "scm:svn:", 0, 8 ) )
-            {
-                url = url.substring( url.indexOf( ':', 4 ) + 1 );
-                protocol = PathUtils.protocol( url );
-            }
-        }
-
-        if ( protocol.equalsIgnoreCase( "file" ) )
-        {
-            retValue = url.substring( protocol.length() + 1 );
-            retValue = decode( retValue );
-            // special case: if omitted // on protocol, keep path as is
-            if ( retValue.startsWith( "//" ) )
-            {
-                retValue = retValue.substring( 2 );
-
-                if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
-                {
-                    // special case: if there is a windows drive letter, then keep the original return value
-                    retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
-                }
-                else
-                {
-                    // Now we expect the host
-                    int index = retValue.indexOf( '/' );
-                    if ( index >= 0 )
-                    {
-                        retValue = retValue.substring( index + 1 );
-                    }
-
-                    // special case: if there is a windows drive letter, then keep the original return value
-                    if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
-                    {
-                        retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
-                    }
-                    else if ( index >= 0 )
-                    {
-                        // leading / was previously stripped
-                        retValue = "/" + retValue;
-                    }
-                }
-            }
-
-            // special case: if there is a windows drive letter using |, switch to :
-            if ( retValue.length() >= 2 && retValue.charAt( 1 ) == '|' )
-            {
-                retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
-            }
-        }
-        else
-        {
-            final String authorization = PathUtils.authorization( url );
-
-            final int port = PathUtils.port( url );
-
-            int pos = 0;
-
-            if ( protocol.equalsIgnoreCase( "scm" ) )
-            {
-                pos = url.indexOf( ':', 4 ) + 1;
-                pos = url.indexOf( ':', pos ) + 1;
-            }
-            else
-            {
-                int index = url.indexOf( "://" );
-                if ( index != -1 )
-                {
-                    pos = index + 3;
-                }
-            }
-
-            pos += authorization.length();
-
-            if ( port != WagonConstants.UNKNOWN_PORT )
-            {
-                pos = pos + Integer.toString( port ).length() + 1;
-            }
-
-            if ( url.length() > pos )
-            {
-                retValue = url.substring( pos );
-                if ( retValue.startsWith( ":" ) )
-                {
-                    // this is for :/ after the host
-                    retValue = retValue.substring( 1 );
-                }
-
-                // one module may be allowed in the path in CVS
-                retValue = retValue.replace( ':', '/' );
-            }
-        }
-
-        if ( retValue == null )
-        {
-            retValue = "/";
-        }
-        return retValue.trim();
-    }
-
-    /**
-     * Decodes the specified (portion of a) URL. <strong>Note:</strong> This decoder assumes that ISO-8859-1 is used to
-     * convert URL-encoded bytes to characters.
-     * 
-     * @param url The URL to decode, may be <code>null</code>.
-     * @return The decoded URL or <code>null</code> if the input was <code>null</code>.
-     */
-    private static String decode( String url )
-    {
-        String decoded = url;
-        if ( url != null )
-        {
-            int pos = -1;
-            while ( ( pos = decoded.indexOf( '%', pos + 1 ) ) >= 0 )
-            {
-                if ( pos + 2 < decoded.length() )
-                {
-                    String hexStr = decoded.substring( pos + 1, pos + 3 );
-                    char ch = (char) Integer.parseInt( hexStr, 16 );
-                    decoded = decoded.substring( 0, pos ) + ch + decoded.substring( pos + 3 );
-                }
-            }
-        }
-        return decoded;
-    }
-
-    public static String user( String url )
-    {
-        String host = authorization( url );
-        int index = host.indexOf( '@' );
-        if ( index > 0 )
-        {
-            String userInfo = host.substring( 0, index );
-            index = userInfo.indexOf( ':' );
-            if ( index > 0 )
-            {
-                return userInfo.substring( 0, index );
-            }
-            else if ( index < 0 )
-            {
-                return userInfo;
-            }
-        }
-        return null;
-    }
-
-    public static String password( String url )
-    {
-        String host = authorization( url );
-        int index = host.indexOf( '@' );
-        if ( index > 0 )
-        {
-            String userInfo = host.substring( 0, index );
-            index = userInfo.indexOf( ':' );
-            if ( index >= 0 )
-            {
-                return userInfo.substring( index + 1 );
-            }
-        }
-        return null;
-    }
-
-    // TODO: move to plexus-utils or use something appropriate from there
-    public static String toRelative( File basedir, String absolutePath )
-    {
-        String relative;
-
-        absolutePath = absolutePath.replace( '\\', '/' );
-        String basedirPath = basedir.getAbsolutePath().replace( '\\', '/' );
-
-        if ( absolutePath.startsWith( basedirPath ) )
-        {
-            relative = absolutePath.substring( basedirPath.length() );
-            if ( relative.startsWith( "/" ) )
-            {
-                relative = relative.substring( 1 );
-            }
-            if ( relative.length() <= 0 )
-            {
-                relative = ".";
-            }
-        }
-        else
-        {
-            relative = absolutePath;
-        }
-
-        return relative;
-    }
-}
diff --git a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
index 49c5e47..263167c 100644
--- a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
@@ -70,8 +70,7 @@ import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  *
  */
-public abstract class AbstractSiteRenderingMojo
-    extends AbstractSiteDescriptorMojo implements Contextualizable
+public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMojo
 {
     /**
      * Module type exclusion mappings
@@ -156,8 +155,6 @@ public abstract class AbstractSiteRenderingMojo
     @Parameter( defaultValue = "${project.reporting}", readonly = true )
     private Reporting reporting;
 
-    private PlexusContainer container;
-
     /**
      * Whether to generate the summary page for project reports: project-info.html.
      *
@@ -182,6 +179,9 @@ public abstract class AbstractSiteRenderingMojo
     @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" )
     private String outputEncoding;
 
+    @Component
+    protected MavenReportExecutor mavenReportExecutor;
+
     /**
      * Gets the input files encoding.
      *
@@ -211,13 +211,6 @@ public abstract class AbstractSiteRenderingMojo
     @Parameter
     private boolean saveProcessedContent;
 
-    /** {@inheritDoc} */
-    public void contextualize( Context context )
-        throws ContextException
-    {
-        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
-    }
-
     protected void checkInputEncoding()
     {
         if ( StringUtils.isEmpty( inputEncoding ) )
@@ -230,34 +223,25 @@ public abstract class AbstractSiteRenderingMojo
     protected List<MavenReportExecution> getReports()
         throws MojoExecutionException
     {
-        try
+        MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
+        mavenReportExecutorRequest.setLocalRepository( localRepository );
+        mavenReportExecutorRequest.setMavenSession( mavenSession );
+        mavenReportExecutorRequest.setProject( project );
+        mavenReportExecutorRequest.setReportPlugins( getReportingPlugins() );
+
+        List<MavenReportExecution> allReports = mavenReportExecutor.buildMavenReports( mavenReportExecutorRequest );
+
+        // filter out reports that can't be generated
+        // todo Lambda Java 1.8
+        List<MavenReportExecution> reportExecutions = new ArrayList<>( allReports.size() );
+        for ( MavenReportExecution exec : allReports )
         {
-            MavenReportExecutor mavenReportExecutor = container.lookup( MavenReportExecutor.class );
-
-            MavenReportExecutorRequest mavenReportExecutorRequest = new MavenReportExecutorRequest();
-            mavenReportExecutorRequest.setLocalRepository( localRepository );
-            mavenReportExecutorRequest.setMavenSession( mavenSession );
-            mavenReportExecutorRequest.setProject( project );
-            mavenReportExecutorRequest.setReportPlugins( getReportingPlugins() );
-
-            List<MavenReportExecution> allReports = mavenReportExecutor.buildMavenReports( mavenReportExecutorRequest );
-
-            // filter out reports that can't be generated
-            // todo Lambda Java 1.8
-            List<MavenReportExecution> reportExecutions = new ArrayList<>( allReports.size() );
-            for ( MavenReportExecution exec : allReports )
+            if ( exec.canGenerateReport() )
             {
-                if ( exec.canGenerateReport() )
-                {
-                    reportExecutions.add( exec );
-                }
+                reportExecutions.add( exec );
             }
-            return reportExecutions;
-        }
-        catch ( ComponentLookupException e )
-        {
-            throw new MojoExecutionException( "could not get MavenReportExecutor component", e );
         }
+        return reportExecutions;
     }
 
     /**