Author: ltheussl
Date: Wed May 30 09:07:35 2012
New Revision: 1344160

URL: http://svn.apache.org/viewvc?rev=1344160&view=rev
Log:
[MPDF-56] Pdf generation fails when there is no site

Added:
    maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/
    maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml   (with props)
    maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh   (with 
props)
Modified:
    
maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml?rev=1344160&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml Wed May 30 
09:07:35 2012
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<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>org.apache.maven.its.pdf</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>PDF Test :: No Site</name>
+  <description>
+    Tests PDF generation without site sources.
+  </description>
+
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.4.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pdf-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <validate>true</validate>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+  
+  
+</project>

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh?rev=1344160&view=auto
==============================================================================
--- maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh (added)
+++ maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh Wed May 30 
09:07:35 2012
@@ -0,0 +1,10 @@
+import java.io.*;
+
+File pdfFile = new File( basedir, "target/pdf/test.pdf" );
+System.out.println( "Checking for existence of " + pdfFile );
+if ( !pdfFile.isFile() )
+{
+    throw new FileNotFoundException( pdfFile + " missing" );
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-pdf-plugin/src/it/no-site/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java?rev=1344160&r1=1344159&r2=1344160&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-pdf-plugin/src/main/java/org/apache/maven/plugins/pdf/PdfMojo.java
 Wed May 30 09:07:35 2012
@@ -592,7 +592,11 @@ public class PdfMojo
         tmpSiteDir.mkdirs();
 
         // copy site
-        FileUtils.copyDirectoryStructure( siteDirectory, tmpSiteDir );
+        if ( siteDirectory.exists() )
+        {
+            FileUtils.copyDirectoryStructure( siteDirectory, tmpSiteDir );
+        }
+
         // Remove SCM files
         List files =
             FileUtils.getFileAndDirectoryNames( tmpSiteDir, 
FileUtils.getDefaultExcludesAsString(), null, true,


Reply via email to