You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/03/19 21:57:33 UTC
svn commit: r1083285 - in /maven/plugins/branches/MSITE-560: ./
src/it/MSITE-312/ src/it/MSITE-312/child/ src/it/MSITE-312/child/src/
src/it/MSITE-312/child/src/site/ src/it/MSITE-312/src/
src/it/MSITE-312/src/site/ src/it/MSITE-354/ src/it/MSITE-548/ ...
Author: hboutemy
Date: Sat Mar 19 20:57:32 2011
New Revision: 1083285
URL: http://svn.apache.org/viewvc?rev=1083285&view=rev
Log:
merged r1081714-1083283 from maven-site-plugin-3.x branch
Added:
maven/plugins/branches/MSITE-560/src/it/MSITE-312/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/child/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/child/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/child/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/child/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-312/child/src/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/child/src/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/child/src/site/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/child/src/site/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/child/src/site/site.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/child/src/site/site.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-312/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-312/src/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/src/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/src/site/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/src/site/
maven/plugins/branches/MSITE-560/src/it/MSITE-312/src/site/site.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/src/site/site.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-312/verify.bsh
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-312/verify.bsh
maven/plugins/branches/MSITE-560/src/it/MSITE-354/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-354/
maven/plugins/branches/MSITE-560/src/it/MSITE-354/goals.txt
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-354/goals.txt
maven/plugins/branches/MSITE-560/src/it/MSITE-354/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-354/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-354/verify.bsh
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-354/verify.bsh
maven/plugins/branches/MSITE-560/src/it/MSITE-548/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/
maven/plugins/branches/MSITE-560/src/it/MSITE-548/invoker.properties
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/invoker.properties
maven/plugins/branches/MSITE-560/src/it/MSITE-548/module1/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/module1/
maven/plugins/branches/MSITE-560/src/it/MSITE-548/module1/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/module1/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-548/module2/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/module2/
maven/plugins/branches/MSITE-560/src/it/MSITE-548/module2/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/module2/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-548/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-548/root/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/root/
maven/plugins/branches/MSITE-560/src/it/MSITE-548/root/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/root/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-548/verify.bsh
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-548/verify.bsh
maven/plugins/branches/MSITE-560/src/it/MSITE-566/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/
maven/plugins/branches/MSITE-560/src/it/MSITE-566/invoker.properties
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/invoker.properties
maven/plugins/branches/MSITE-560/src/it/MSITE-566/pom.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/pom.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-566/src/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/src/
maven/plugins/branches/MSITE-560/src/it/MSITE-566/src/site/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/src/site/
maven/plugins/branches/MSITE-560/src/it/MSITE-566/src/site/apt/
- copied from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/src/site/apt/
maven/plugins/branches/MSITE-560/src/it/MSITE-566/src/site/apt/index.apt
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/src/site/apt/index.apt
maven/plugins/branches/MSITE-560/src/it/MSITE-566/src/site/site.xml
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/src/site/site.xml
maven/plugins/branches/MSITE-560/src/it/MSITE-566/verify.bsh
- copied unchanged from r1083283, maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-566/verify.bsh
Modified:
maven/plugins/branches/MSITE-560/ (props changed)
maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java
Propchange: maven/plugins/branches/MSITE-560/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar 19 20:57:32 2011
@@ -1,2 +1,2 @@
-/maven/plugins/branches/maven-site-plugin-3.x:1078256-1078272,1078348-1078421,1078486-1078532
-/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018
+/maven/plugins/branches/maven-site-plugin-3.x:1078256-1078272,1078348-1078421,1078486-1078532,1078780-1080675
+/maven/plugins/trunk/maven-site-plugin:801155,801171,801470,806898-806906,807943-808180,809252,810298,884137,886844,886847,890094,890124,891014,891688,920027,920041,942622,943455,944145,950463,956681,984466,984960,984991,984996,1029307,1033379,1037476,1039137,1039143,1039748-1039749,1049020,1051139-1051449,1055019,1055033,1055047,1055089,1060289,1063639,1064626,1065576,1065582,1066038,1067103,1067120,1070079-1070080,1070100,1070104,1074118,1075018,1075782,1075810,1075995,1076167,1076195,1077911,1077924,1078235,1079474,1079529,1079698,1080781,1081837,1081887,1082091,1082242,1082274
Modified: maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1083285&r1=1083284&r2=1083285&view=diff
==============================================================================
--- maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original)
+++ maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Sat Mar 19 20:57:32 2011
@@ -132,7 +132,6 @@ public abstract class AbstractDeployMojo
*/
protected MavenSession mavenSession;
-
/**
* @since 3.0-beta-2
* @component
@@ -150,8 +149,8 @@ public abstract class AbstractDeployMojo
public void execute()
throws MojoExecutionException
{
- deployTo( new org.apache.maven.plugins.site.wagon.repository.Repository(
- getDeployRepositoryID(), getDeployRepositoryURL() ) );
+ deployTo( new org.apache.maven.plugins.site.wagon.repository.Repository( getDeployRepositoryID(),
+ getDeployRepositoryURL() ) );
}
/**
@@ -319,13 +318,13 @@ public abstract class AbstractDeployMojo
return wagon;
}
- private static void push( final File inputDirectory, final Repository repository,
- final WagonManager manager, final Wagon wagon, final ProxyInfo proxyInfo,
- final List<Locale> localesList, final String relativeDir, final Log log )
+ private static void push( final File inputDirectory, final Repository repository, final WagonManager manager,
+ final Wagon wagon, final ProxyInfo proxyInfo, final List<Locale> localesList,
+ final String relativeDir, final Log log )
throws MojoExecutionException
{
AuthenticationInfo authenticationInfo = manager.getAuthenticationInfo( repository.getId() );
- log.debug( "authenticationInfo with id '" + repository.getId() + "' : " + authenticationInfo.getUserName() );
+ log.debug( "authenticationInfo with id '" + repository.getId() + "': " + authenticationInfo.getUserName() );
try
{
@@ -350,6 +349,7 @@ public abstract class AbstractDeployMojo
log.debug( "connect without authenticationInfo and without proxyInfo" );
wagon.connect( repository );
}
+
// Default is first in the list
final String defaultLocale = localesList.get( 0 ).getLanguage();
@@ -358,7 +358,7 @@ public abstract class AbstractDeployMojo
if ( locale.getLanguage().equals( defaultLocale ) )
{
// TODO: this also uploads the non-default locales,
- // is there a way to exlude directories in wagon?
+ // is there a way to exclude directories in wagon?
wagon.putDirectory( inputDirectory, relativeDir );
}
else
@@ -475,7 +475,15 @@ public abstract class AbstractDeployMojo
return proxyInfo;
}
-
+ /**
+ * Get proxy information for Maven 3.
+ *
+ * @param repository
+ * @param log
+ * @param mavenSession
+ * @param settingsDecrypter
+ * @return
+ */
private static ProxyInfo getProxy( Repository repository, Log log, MavenSession mavenSession, SettingsDecrypter settingsDecrypter )
{
String protocol = repository.getProtocol();
@@ -565,7 +573,7 @@ public abstract class AbstractDeployMojo
* @throws WagonConfigurationException
*/
private static void configureWagon( Wagon wagon, String repositoryId, Settings settings, PlexusContainer container,
- Log log )
+ Log log )
throws TransferFailedException
{
log.debug( " configureWagon " );
@@ -574,8 +582,10 @@ public abstract class AbstractDeployMojo
for ( int i = 0; i < settings.getServers().size(); i++ )
{
Server server = (Server) settings.getServers().get( i );
- log.debug( "configureWagon server " + server.getId() );
String id = server.getId();
+
+ log.debug( "configureWagon server " + id );
+
if ( id != null && id.equals( repositoryId ) )
{
if ( server.getConfiguration() != null )
Modified: maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java?rev=1083285&r1=1083284&r2=1083285&view=diff
==============================================================================
--- maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java (original)
+++ maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java Sat Mar 19 20:57:32 2011
@@ -127,30 +127,4 @@ public abstract class AbstractSiteMojo
{
return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : outputEncoding;
}
-
- /**
- * TODO should be removed see PLXUTILS-61
- *
- * @param basedir
- * @param absolutePath
- * @return
- */
- protected 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() + 1 );
- }
- else
- {
- relative = absolutePath;
- }
-
- return relative;
- }
}
Modified: maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=1083285&r1=1083284&r2=1083285&view=diff
==============================================================================
--- maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original)
+++ maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Sat Mar 19 20:57:32 2011
@@ -207,6 +207,15 @@ public abstract class AbstractSiteRender
*/
private boolean relativizeDecorationLinks;
+ /**
+ * Whether to generate the summary page for project reports: project-info.html.
+ *
+ * @parameter expression="${generateProjectInfo}" default-value="true"
+ *
+ * @since 2.3
+ */
+ private boolean generateProjectInfo;
+
protected List<MavenReportExecution> getReports()
throws MojoExecutionException
{
@@ -271,8 +280,8 @@ public abstract class AbstractSiteRender
try
{
decorationModel = siteTool.getDecorationModel( project, reactorProjects, localRepository, repositories,
- toRelative( project.getBasedir(),
- siteDirectory.getAbsolutePath() ),
+ siteTool.getRelativePath( siteDirectory.getAbsolutePath(),
+ project.getBasedir().getAbsolutePath() ),
locale, getInputEncoding(), getOutputEncoding() );
}
catch ( SiteToolException e )
@@ -442,7 +451,7 @@ public abstract class AbstractSiteRender
siteTool.populateReportsMenu( context.getDecoration(), locale, categories );
populateReportItems( context.getDecoration(), locale, reportsByOutputName );
- if ( categories.containsKey( MavenReport.CATEGORY_PROJECT_INFORMATION ) )
+ if ( categories.containsKey( MavenReport.CATEGORY_PROJECT_INFORMATION ) && generateProjectInfo )
{
List<MavenReport> categoryReports = categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
Modified: maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java?rev=1083285&r1=1083284&r2=1083285&view=diff
==============================================================================
--- maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java (original)
+++ maven/plugins/branches/MSITE-560/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java Sat Mar 19 20:57:32 2011
@@ -21,23 +21,14 @@ package org.apache.maven.plugins.site;
import java.io.File;
import java.io.IOException;
-import java.io.StringReader;
-import java.io.Writer;
import java.util.List;
import java.util.Locale;
-import org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader;
-import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Writer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProjectHelper;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.XmlStreamReader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.codehaus.plexus.util.FileUtils;
/**
* Adds the site descriptor (<code>site.xml</code>) to the list of files to be installed/deployed.
@@ -73,71 +64,47 @@ public class SiteDescriptorAttachMojo
for ( Locale locale : localesList )
{
- File descriptorFile = siteTool.getSiteDescriptorFromBasedir( toRelative( project.getBasedir(),
- siteDirectory.getAbsolutePath() ),
+ File descriptorFile = siteTool.getSiteDescriptorFromBasedir(
+ siteTool.getRelativePath( siteDirectory.getAbsolutePath(), project.getBasedir().getAbsolutePath() ),
basedir, locale );
if ( descriptorFile.exists() )
{
- DecorationModel decoration;
- XmlStreamReader reader = null;
- try
- {
- reader = ReaderFactory.newXmlReader( descriptorFile );
- String siteDescriptorContent = IOUtil.toString( reader );
-
- decoration = new DecorationXpp3Reader().read( new StringReader( siteDescriptorContent ) );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( "Error parsing site descriptor", e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error reading site descriptor", e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
// Calculate the classifier to use
- String classifier = null;
- int index = descriptorFile.getName().lastIndexOf( '.' );
- if ( index > 0 )
- {
- classifier = descriptorFile.getName().substring( 0, index );
- }
- else
- {
- throw new MojoExecutionException( "Unable to determine the classifier to use" );
- }
-
+ String classifier = getClassifier( descriptorFile );
// Prepare a file for the interpolated site descriptor
String filename = project.getArtifactId() + "-" + project.getVersion() + "-" + descriptorFile.getName();
- File interpolatedDescriptorFile = new File( project.getBuild().getDirectory(), filename );
- interpolatedDescriptorFile.getParentFile().mkdirs();
+ File targetDescriptorFile = new File( project.getBuild().getDirectory(), filename );
- Writer writer = null;
try
{
- // Write the interpolated site descriptor to a file
- writer = WriterFactory.newXmlWriter( interpolatedDescriptorFile );
- new DecorationXpp3Writer().write( writer, decoration );
- // Attach the interpolated site descriptor
- getLog().debug( "Attaching the site descriptor '" + interpolatedDescriptorFile.getAbsolutePath()
+ // Copy the site descriptor to a file
+ FileUtils.copyFile( descriptorFile, targetDescriptorFile );
+ // Attach the site descriptor
+ getLog().debug( "Attaching the site descriptor '" + targetDescriptorFile.getAbsolutePath()
+ "' with classifier '" + classifier + "' to the project." );
- projectHelper.attachArtifact( project, "xml", classifier, interpolatedDescriptorFile );
+ projectHelper.attachArtifact( project, "xml", classifier, targetDescriptorFile );
}
catch ( IOException e )
{
- throw new MojoExecutionException( "Unable to store interpolated site descriptor", e );
- }
- finally
- {
- IOUtil.close( writer );
+ throw new MojoExecutionException( "Unable to copy site descriptor", e );
}
}
}
}
+
+ private static String getClassifier( final File descriptorFile )
+ throws MojoExecutionException
+ {
+ final int index = descriptorFile.getName().lastIndexOf( '.' );
+
+ if ( index > 0 )
+ {
+ return descriptorFile.getName().substring( 0, index );
+ }
+ else
+ {
+ throw new MojoExecutionException( "Unable to determine the classifier to use" );
+ }
+ }
}