Author: ltheussl Date: Wed Jul 13 10:17:35 2011 New Revision: 1145947 URL: http://svn.apache.org/viewvc?rev=1145947&view=rev Log: [MSITE-367] [MSITE-541] add skip and skipDeploy options
Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/invoker.properties maven/plugins/trunk/maven-site-plugin/src/it/site-skip/pom.xml maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/pom.xml maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/pom.xml maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/pom.xml maven/plugins/trunk/maven-site-plugin/src/it/site-skip/verify.bsh Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/invoker.properties?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/invoker.properties (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/invoker.properties Wed Jul 13 10:17:35 2011 @@ -0,0 +1,2 @@ +invoker.goals.1 = clean +invoker.goals.2 = site:site site:deploy site:stage site:stage-deploy Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/pom.xml?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/pom.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/pom.xml Wed Jul 13 10:17:35 2011 @@ -0,0 +1,38 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>test-site-skip</groupId> + <artifactId>top</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>Top</name> + + <distributionManagement> + <site> + <id>site</id> + <url>file:///@project.build.directory@/it/site-skip/deployed/</url> + </site> + </distributionManagement> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <generateReports>false</generateReports> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <modules> + <module>site</module> + <module>skip-site</module> + <module>skip-site-deploy</module> + </modules> + +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/pom.xml?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/pom.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/site/pom.xml Wed Jul 13 10:17:35 2011 @@ -0,0 +1,15 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>test-site-skip</groupId> + <artifactId>top</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>site</artifactId> + <packaging>pom</packaging> + <name>Site</name> + +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/pom.xml?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/pom.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site-deploy/pom.xml Wed Jul 13 10:17:35 2011 @@ -0,0 +1,27 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>test-site-skip</groupId> + <artifactId>top</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>site-deploy-skip</artifactId> + <packaging>pom</packaging> + <name>Skip Site Deploy</name> + + + <build> + <plugins> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <configuration> + <skipDeploy>true</skipDeploy> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/pom.xml?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/pom.xml (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/skip-site/pom.xml Wed Jul 13 10:17:35 2011 @@ -0,0 +1,28 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>test-site-skip</groupId> + <artifactId>top</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>site-skip</artifactId> + <packaging>pom</packaging> + <name>Skip Site</name> + + <build> + <plugins> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <configuration> + <!-- when site is skipped, deploy needs to be skipped too --> + <skip>true</skip> + <skipDeploy>true</skipDeploy> + </configuration> + </plugin> + </plugins> + </build> + +</project> Added: maven/plugins/trunk/maven-site-plugin/src/it/site-skip/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/site-skip/verify.bsh?rev=1145947&view=auto ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/it/site-skip/verify.bsh (added) +++ maven/plugins/trunk/maven-site-plugin/src/it/site-skip/verify.bsh Wed Jul 13 10:17:35 2011 @@ -0,0 +1,159 @@ + +/* + * 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 java.io.*; +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + final File deployDirectory = new File( basedir, "deployed" ); + final File stageDirectory = new File( basedir, "target/staging" ); + final File stageDeployDirectory = new File( deployDirectory, "staging" ); + + // top + + File siteDir = new File( basedir, "target/site" ); + if ( !siteDir.exists() || !siteDir.isDirectory() ) + { + System.err.println( "top site is missing or not a directory." ); + result = false; + } + + File stageDir = new File( stageDirectory, "." ); + if ( !stageDir.exists() || !stageDir.isDirectory() ) + { + System.err.println( "top stage site is missing or not a directory." ); + result = false; + } + + File deployDir = new File( deployDirectory, "." ); + if ( !deployDir.exists() || !deployDir.isDirectory() ) + { + System.err.println( "top deploy site is missing or not a directory." ); + result = false; + } + + File stageDeployDir = new File( stageDeployDirectory, "." ); + if ( !stageDeployDir.exists() || !stageDeployDir.isDirectory() ) + { + System.err.println( "top stage-deploy site is missing or not a directory." ); + result = false; + } + + // site + + siteDir = new File( basedir, "site/target/site" ); + if ( !siteDir.exists() || !siteDir.isDirectory() ) + { + System.err.println( "site site is missing or not a directory." ); + result = false; + } + + stageDir = new File( stageDirectory, "site" ); + if ( !stageDir.exists() || !stageDir.isDirectory() ) + { + System.err.println( "site stage site is missing or not a directory." ); + result = false; + } + + deployDir = new File( deployDirectory, "site" ); + if ( !deployDir.exists() || !deployDir.isDirectory() ) + { + System.err.println( "site deploy site is missing or not a directory." ); + result = false; + } + + stageDeployDir = new File( stageDeployDirectory, "site" ); + if ( !stageDeployDir.exists() || !stageDeployDir.isDirectory() ) + { + System.err.println( "site stage-deploy site is missing or not a directory." ); + result = false; + } + + // skip-site + + siteDir = new File( basedir, "skip-site/target/site" ); + if ( siteDir.exists() ) + { + System.err.println( "skip-site site exists." ); + result = false; + } + + stageDir = new File( stageDirectory, "skip-site" ); + if ( stageDir.exists() ) + { + System.err.println( "skip-site stage site exists." ); + result = false; + } + + deployDir = new File( deployDirectory, "skip-site" ); + if ( deployDir.exists() ) + { + System.err.println( "skip-site deploy site exists." ); + result = false; + } + + stageDeployDir = new File( stageDeployDirectory, "skip-site" ); + if ( stageDeployDir.exists() ) + { + System.err.println( "skip-site stage-deploy site exists." ); + result = false; + } + + // skip-site-deploy + + siteDir = new File( basedir, "skip-site-deploy/target/site" ); + if ( !siteDir.exists() || !siteDir.isDirectory() ) + { + System.err.println( "skip-site-deploy site is missing or not a directory." ); + result = false; + } + + stageDir = new File( stageDirectory, "skip-site-deploy" ); + if ( stageDir.exists() ) + { + System.err.println( "skip-site-deploy stage site exists." ); + result = false; + } + + deployDir = new File( deployDirectory, "skip-site-deploy" ); + if ( deployDir.exists() ) + { + System.err.println( "skip-site-deploy deploy site exists." ); + result = false; + } + + stageDeployDir = new File( stageDeployDirectory, "skip-site-deploy" ); + if ( stageDeployDir.exists() ) + { + System.err.println( "skip-site-deploy stage-deploy site exists." ); + result = false; + } + +} +catch( IOException e ) +{ + e.printStackTrace(); + result = false; +} + +return result; Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java?rev=1145947&r1=1145946&r2=1145947&view=diff ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java (original) +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractDeployMojo.java Wed Jul 13 10:17:35 2011 @@ -108,6 +108,14 @@ public abstract class AbstractDeployMojo private String chmodOptions; /** + * Set this to 'true' to skip site deployment. + * + * @parameter expression="${maven.site.deploy.skip}" default-value="false" + * @since 2.4 + */ + private boolean skipDeploy; + + /** * @component */ private WagonManager wagonManager; @@ -132,6 +140,12 @@ public abstract class AbstractDeployMojo public void execute() throws MojoExecutionException { + if ( skipDeploy ) + { + getLog().info( "maven.site.deploy.skip = true: Skipping site deployment" ); + return; + } + deployTo( new org.apache.maven.plugins.site.wagon.repository.Repository( getDeployRepositoryID(), appendSlash( getDeployRepositoryURL() ) ) ); Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java?rev=1145947&r1=1145946&r2=1145947&view=diff ============================================================================== --- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java (original) +++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java Wed Jul 13 10:17:35 2011 @@ -84,6 +84,14 @@ public class SiteMojo private boolean validate; /** + * Set this to 'true' to skip site generation. + * + * @parameter expression="${maven.site.skip}" default-value="false" + * @since 2.4 + */ + private boolean skip; + + /** * {@inheritDoc} * * Generate the project site @@ -95,6 +103,12 @@ public class SiteMojo public void execute() throws MojoExecutionException, MojoFailureException { + if ( skip ) + { + getLog().info( "maven.site.skip = true: Skipping site generation" ); + return; + } + checkMavenVersion(); List<MavenReport> filteredReports;