ascheman opened a new pull request, #1287:
URL: https://github.com/apache/maven-site-plugin/pull/1287

   Fixes #1286.
   
   ## Problem
   
   The site 2.0.0 descriptor no longer provides a default skin (removed in the 
site-model rework, DOXIASITETOOLS-311). A project whose site descriptor 
declares none fails the site build with a cryptic
   
   ```
   java.lang.NullPointerException: skin cannot be null
       at 
org.apache.maven.doxia.tools.DefaultSiteTool.getSkinArtifactFromRepository(DefaultSiteTool.java:150)
   ```
   
   thrown deep in doxia-sitetools, with no hint about what's wrong or how to 
fix it.
   
   ## Fix
   
   Check for a null skin in 
`AbstractSiteRenderingMojo.createSiteRenderingContext` before resolving it, and 
throw a `MojoExecutionException` that explains an explicit `<skin>` is required 
(with a `maven-fluido-skin` example) and points at parent site-descriptor 
inheritance:
   
   ```
   No skin is declared in the site descriptor. Since the site descriptor 2.0.0 
no longer provides a
   default skin, a skin must be declared explicitly, for example in 
src/site/site.xml:
     <skin>
       <groupId>org.apache.maven.skins</groupId>
       <artifactId>maven-fluido-skin</artifactId>
       <version>...</version>
     </skin>
   The skin is normally inherited from the Maven parent's site descriptor; 
check that the parent
   site descriptor is resolvable if you expected it to be inherited.
   ```
   
   The check only fires when no skin is resolvable anywhere (a project 
inheriting the parent's skin has a non-null `siteModel.getSkin()`), so there's 
no behavior change for the normal case. I kept this a clear error rather than 
restoring a default skin, since the default was deliberately dropped in the 
2.0.0 model — happy to switch to defaulting if maintainers prefer.
   
   ## Testing
   
   New IT `src/it/projects/gh-1286-missing-skin` (a `SITE/2.0.0` descriptor 
with no `<skin>`, `invoker.buildResult = failure`) asserts the build fails with 
the clear message and **not** the NPE. Verified locally against Maven 3.9.16 — 
`Passed: 1, Failed: 0`. The NPE reproduces identically on Maven 3 and Maven 4, 
so the IT is Maven-version-independent.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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