Uploaded image for project: 'Maven Doxia Sitetools'
  1. Maven Doxia Sitetools
  2. DOXIASITETOOLS-108

NullPointerException when site URL is being generated

    XMLWordPrintableJSON

Details

    Description

      We have a parent POM where the site url is generated via the Maven Groovy plugin, unless it is explicitly defined in the child POM
      i.e.

      <site>
         <id>project-sites</id>
         <name>Our project Nexus server Site</name>
         <!-- URL is built dynamically by groovy plugin -->
      </site>
      ...
      
      <plugin>
         <groupId>org.codehaus.groovy.maven</groupId>
         <artifactId>gmaven-plugin</artifactId>
         <executions>
      	<execution>
      	<phase>pre-site</phase>
      	<goals>
      	   <goal>execute</goal>
      	</goals>
      	<configuration>
      	<source>
                <![CDATA[
                     if(!project.distributionManagement.site.url){
                          String version = new String(project.version)
                          String path = new String(project.artifactId)+'/'+version
                          project.distributionManagement.site.url ='dav:'+project.properties['siteBaseURL'] + path
                     }
                ]]>
      
      	</source>
      	</configuration>
      	</execution>
         </executions>
      </plugin>
      

      This leads to a NullPointerException in DefaultSiteTool.java:

      at java.io.File.<init>(File.java:222)
      at org.apache.maven.doxia.tools.DefaultSiteTool.urlEncode(DefaultSiteTool.java:1478)
      at org.apache.maven.doxia.tools.DefaultSiteTool.getDistMgmntSiteUrl(DefaultSiteTool.java:1451)

      The if statement in getDistMgntSiteUrl (for both methods) should test for null on project.getDistributionManagement().getSite().getUrl()

      Attachments

        Activity

          People

            dennisl@apache.org Dennis Lundberg
            marc claessens Marc Claessens
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: