devacfr / reflow-maven-skin

Reflow is an Apache Maven site skin built on Bootstrap. It allows various structural and stylistic customizations to create a modern-looking Maven-generated website.
http://devacfr.github.io/reflow-maven-skin/
Apache License 2.0
8 stars 3 forks source link

Maven build failure #101

Open ilacc1 opened 6 months ago

ilacc1 commented 6 months ago

I can't seem to get the config right to build a site.

Relevant pom sections ( I tried with both maven-site-plugin.version 4.0.0-M13 and M9).

    <properties>
        <main.basedir>${session.executionRootDirectory}</main.basedir>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
        <siteMainDirectory>${user.home}</siteMainDirectory>
        <site.url>http://localhost</site.url>
        <generate.site.path>${main.basedir}/target/site</generate.site.path>
        <maven-site-plugin.version>4.0.0-M13</maven-site-plugin.version>
        <maven-project-info-reports-plugin.version>3.5.0</maven-project-info-reports-plugin.version>
    </properties>
    <build>
                 <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven-site-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>io.github.devacfr.maven.skins</groupId>
                        <artifactId>reflow-velocity-tools</artifactId>
                        <version>2.3.4</version>
                    </dependency>
                </dependencies>
            </plugin>
             </plugins>
     </build>

site.xml

  xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 http://maven.apache.org/xsd/site-2.0.0.xsd"  -->
<project>
  <skin>
    <groupId>io.github.devacfr.maven.skins</groupId>
    <artifactId>reflow-maven-skin</artifactId>
    <version>2.3.4</version>
  </skin>
  <version position="bottom" />
  <!--bannerLeft >
        <src>images/logo-7.png</src>
        <href>index.html</href>
  </bannerLeft-->

  <custom>
    <reflowSkin>
    <localResources>false</localResources>
    <absoluteResourceURL>http://localhost</absoluteResourceURL>
      <protocolRelativeURLs>true</protocolRelativeURLs>
      <smoothScroll>true</smoothScroll>
      <theme>bootswatch-flatly</theme>
      <highlightJs>true</highlightJs>
      <maxNavSpan>12</maxNavSpan>
      <highlightJsTheme>github</highlightJsTheme>
      <bootstrapIcons>true</bootstrapIcons>
      <brand>Some Software</brand>
      <titleTemplate> </titleTemplate>
      <slogan>Something else</slogan>
      <markPageHeader>false</markPageHeader>
      <skinAttribution>false</skinAttribution>
      <nav>false</nav>
      <navbar>false</navbar>
      <footer>false</footer>
      <breadcrumbs>false</breadcrumbs>

      <pages>
          <index>
            <toc>top</toc>
          </index>
      </pages>
    </reflowSkin>
  </custom>
  <body>

  </body>
</project>

Exception trace:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:4.0.0-M13:site (default-site) on project vanco-rm-servlet: Failed to render reports
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to render reports
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:117)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.doxia.siterenderer.RendererException: Velocity error while merging site template.
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.mergeDocumentIntoSite (DefaultSiteRenderer.java:625)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:388)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:46)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:298)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:227)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:147)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getCurrentFileLocation' in  class org.devacfr.maven.skins.reflow.SkinConfigTool threw exception java.lang.NullPointerException: Cannot invoke "String.length()" because "this.input" is null at META-INF/maven/page-default.vm[line 44, column 40]
    at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute (ASTIdentifier.java:246)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute (ASTReference.java:368)
    at org.apache.velocity.runtime.parser.node.ASTReference.value (ASTReference.java:704)
    at org.apache.velocity.runtime.parser.node.ASTExpression.value (ASTExpression.java:75)
    at org.apache.velocity.runtime.parser.node.ASTSetDirective.render (ASTSetDirective.java:242)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.runtime.directive.Parse.render (Parse.java:284)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render (ASTDirective.java:304)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render (ASTBlock.java:147)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render (ASTIfStatement.java:190)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.Template.merge (Template.java:358)
    at org.apache.velocity.Template.merge (Template.java:262)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.mergeDocumentIntoSite (DefaultSiteRenderer.java:622)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:388)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:46)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:298)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:227)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:147)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "this.input" is null
    at java.net.URI$Parser.parse (URI.java:3167)
    at java.net.URI.<init> (URI.java:623)
    at java.net.URI.create (URI.java:904)
    at org.devacfr.maven.skins.reflow.URITool.toURI (URITool.java:81)
    at org.devacfr.maven.skins.reflow.SkinConfigTool.getCurrentFileLocation (SkinConfigTool.java:639)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute (PropertyExecutor.java:149)
    at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke (UberspectImpl.java:722)
    at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute (ASTIdentifier.java:217)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute (ASTReference.java:368)
    at org.apache.velocity.runtime.parser.node.ASTReference.value (ASTReference.java:704)
    at org.apache.velocity.runtime.parser.node.ASTExpression.value (ASTExpression.java:75)
    at org.apache.velocity.runtime.parser.node.ASTSetDirective.render (ASTSetDirective.java:242)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.runtime.directive.Parse.render (Parse.java:284)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render (ASTDirective.java:304)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render (ASTBlock.java:147)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render (ASTIfStatement.java:190)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render (SimpleNode.java:439)
    at org.apache.velocity.Template.merge (Template.java:358)
    at org.apache.velocity.Template.merge (Template.java:262)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.mergeDocumentIntoSite (DefaultSiteRenderer.java:622)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:388)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:46)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:298)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:227)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:147)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:110)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
devacfr commented 6 months ago

Hello @ilacc1, I suppose you have to use the new model in site.xml

<site xmlns="http://maven.apache.org/SITE/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SITE/2.0.0 https://maven.apache.org/xsd/site-2.0.0.xsd"
  name="${project.name}">
...
</site>
ilacc1 commented 6 months ago

Hi - actually, this was likely happening because pom didn't have a url specified. Adding:

<url>https://locahost</url>

seems to have fixed the problem.

If it helps, I think the code in question is in SkinConfigTool, specifically Nonnull annotation on a method (getProjectLocation) that can very much return null:

    /**
     * @return Returns a {@link String} representing the location path of current rendered file.
     */
    @Nonnull
    public String getCurrentFileLocation() {
        final String projectSiteLoc = getProjectLocation();
        return URITool.toURI(projectSiteLoc).resolve(getCurrentFileName()).toString();
    }
devacfr commented 6 months ago

Thank, I will fix it.