PROBLEM
The default Maven generated site looks like web pages created in the 80s:-
SOLUTION
The good news is Maven allows us to change the skin.
To use one of these pre-defined skins, create site.xml
at this location:-
├── pom.xml
└── src
├── main
│ └── java
│ └── ...
└── site
└── site.xml
In site.xml
, enter the following:-
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/DECORATION/1.6.0"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0
http://maven.apache.org/xsd/decoration-1.6.0.xsd">
<bannerLeft>
<name>${project.name}</name>
<href>${project.url}</href>
</bannerLeft>
<publishDate position="right" format="MMMM dd, yyyy"/>
<version/>
<poweredBy>
<logo img="#" alt=""/>
</poweredBy>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.4</version>
</skin>
<body>
<menu ref="reports"/>
<footer/>
</body>
</project>
In the above example, we use Maven Fluido Skin.
In Maven 3, site:attach-descriptor
has been removed from the built-in lifecycle bindings, so we need to explicitly define attach-descriptor
goal in Maven Site Plugin to pick up src/site/site.xml
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
When you run mvn clean site
, oh hey, welcome to 21st century!
Leave a Reply