ascheman opened a new issue, #1286:
URL: https://github.com/apache/maven-site-plugin/issues/1286

   ### Description
   
   Since the site descriptor 2.0.0 no longer supplies a default skin, a project 
whose `src/site/site.xml` (using the `SITE/2.0.0` namespace) declares no 
`<skin>` fails the site build with a bare `NullPointerException` instead of an 
actionable message.
   
   ### Steps to reproduce
   
   Self-contained, no parent POM needed. maven-site-plugin 3.22.0, Maven 
4.0.0-rc-5, JDK 21.
   
   `pom.xml`:
   
   ```xml
   <project xmlns="http://maven.apache.org/POM/4.0.0";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.test</groupId>
     <artifactId>site-skin-npe-repro</artifactId>
     <version>1</version>
     <packaging>pom</packaging>
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-site-plugin</artifactId>
           <version>3.22.0</version>
         </plugin>
       </plugins>
     </build>
   </project>
   ```
   
   `src/site/site.xml` (no `<skin>`):
   
   ```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";>
     <body>
       <menu name="Overview"><item name="Introduction" 
href="index.html"/></menu>
     </body>
   </site>
   ```
   
   `mvn site` →
   
   ```
   [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-site-plugin:3.22.0:site (default-site) ... : 
skin cannot be null
   Caused by: java.lang.NullPointerException: skin cannot be null
       at java.util.Objects.requireNonNull(Objects.java:259)
       at 
org.apache.maven.doxia.tools.DefaultSiteTool.getSkinArtifactFromRepository(DefaultSiteTool.java:150)
       at 
org.apache.maven.plugins.site.render.AbstractSiteRenderingMojo.createSiteRenderingContext(AbstractSiteRenderingMojo.java:309)
       at 
org.apache.maven.plugins.site.render.SiteMojo.renderLocale(SiteMojo.java:141)
       at 
org.apache.maven.plugins.site.render.SiteMojo.execute(SiteMojo.java:125)
   ```
   
   Adding an explicit `<skin>` (e.g. `maven-fluido-skin`) makes the build pass 
— but nothing in the error tells the user that's the fix. Also hit in the wild 
on apache/maven-source-plugin master (worked around in 
apache/maven-source-plugin#310).
   
   ### Expected behavior
   
   A clear, actionable error — e.g. *"No `<skin>` is declared in the site 
descriptor. Since site descriptor 2.0.0 no longer supplies a default skin, 
declare one explicitly (e.g. `org.apache.maven.skins:maven-fluido-skin`)."* — 
or restore a sensible default when none is configured.
   
   ### Notes
   
   - The NPE is the `Objects.requireNonNull(skin, "skin cannot be null")` guard 
in `DefaultSiteTool.getSkinArtifactFromRepository` (doxia-sitetools); 
`AbstractSiteRenderingMojo` passes a null skin when the descriptor has none. A 
fix could live here in maven-site-plugin (validate + emit a clear message 
before the call) and/or in doxia-sitetools (throw a `SiteToolException` with 
guidance, or default the skin).
   - Reproduces standalone; parent site descriptors aren't inherited anyway 
(`mvn site -X` shows `No parent level N site descriptor`, since parent POMs 
don't publish a site-descriptor artifact).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to