Removing the About link from maven site - maven

I'm using mvn site to generate my site's documentation. For the most part, I'm satisfied with the default site, but I'd like to remove the "About" link from the left hand menu bar and just have the default page be the "Project Information" page. Is there an easy way to do this?

Here only the 'About' report is still included. All other standard reports are removed.
<reporting>
<plugins>
<!-- Add the Maven project information reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1.2</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<!--
<report>dependencies</report>
<report>project-team</report>
<report>mailing-list</report>
<report>cim</report>
<report>issue-tracking</report>
<report>license</report>
<report>scm</report>
-->
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

You can either modify the source and comment it out or add a css selector for it, or you can include a JS library like jQuery and remove it when the page loads via something like:
$(function () {
// untested
$('#navcolumn h5:contains("Maven")').hide(); // hide the header
$('#navcolumn h5:contains("Maven") + ul ').hide(); // hide the ul
})();

I ended up not using that plugin at all and just used the maven-site-plugin. Maven 3 has a reportPlugins configuration section of the maven pom that lets you specified which reports you want to show up http://maven.apache.org/plugins/maven-site-plugin/maven-3.html
org.apache.maven.plugins
maven-site-plugin
3.0
org.codehaus.mojo
cobertura-maven-plugin
I also provided my own index.apt (in src/site/apt) file to customize the index page text.

I know this is an old question, but I've always found it quite annoying. The 'About' section is redundant, and more important, cause the 'Project Information' menu is expanded by default when you visit the site. Since I didn't found any solution on the web, I had to figure it out myself.
With the following workaround, the 'About' item under the 'Project Information' menu will completely disappear from the site. Just add this to the site.xml file:
...
<body>
<head>
<![CDATA[
<script type="text/javascript">
$(document).ready(function () {
var linkAbout = $('a').filter(function(index) { return $(this).text() === "About"; });
var projectInformationMenu = $('a').filter(function(index) { return $(this).text() === "Project Information"; });
linkAbout.hide();
if (!projectInformationMenu.parent().hasClass('active')) {
projectInformationMenu.parent().children('ul').hide();
projectInformationMenu.children('span').removeClass('icon-chevron-down').addClass('icon-chevron-right');
}
});
</script>
]]>
</head>
...
</body>

Related

How to change swagger group name (names displayed in the dropdown menu) with swagger-annotations and swagger-maven-plugin

I'm using Swagger-maven-plugin and Swagger-annotations.
I have two java controllers in the same package xxcontrollerV1 and xxcontrollerV2 which are annotated with #Api(value = "xxcontrollerV1",tags = {"xxcontroller V1"}),
In swagger-ui dropdown group, they appear with the same name "xxcontroller API" without version.
here is my swagger-maven-plugin configuration :
<apiSource>
<locations>
<location>
webservices.api.xxapi.web.controller.xxControllerV1
</location>
</locations>
<basePath>[BASEPATH_TAG]</basePath>
<info>
<title>XX API V1</title>
<version>${project.version}</version>
</info>
<securityDefinitions>
<securityDefinition>
<jsonPath>${project.basedir}/securityDefinition-BearerToken.json</jsonPath>
</securityDefinition>
</securityDefinitions>
<swaggerDirectory>
${project.build.directory}/${project.build.finalName}/swagger/xx_v1
</swaggerDirectory>
<outputFormats>json</outputFormats>
</apiSource>
<apiSource>
<locations>
<location>
webservices.api.xxapi.web.controller.xxControllerV2
</location>
</locations>
<basePath>[BASEPATH_TAG]</basePath>
<info>
<title>XX API V2</title>
<version>${project.version}</version>
</info>
<swaggerDirectory>
${project.build.directory}/${project.build.finalName}/swagger/xx_v2
</swaggerDirectory>
<outputFormats>json</outputFormats>
</apiSource>
Is there any way to modify the name of group displayed in the dropdown ?
Thanks !

Adding custom classes required by maven-antrun-plugin

I have an Ant task which is executed in maven by using maven-antrun-plugin. This tas uses an XmlTask to read some values from an XML file. The task fails with a class load error as the definition for this tas is in a separate jar. How can I add this jar to the classpath? I have tried adding this jar to the lib directory of both Maven and Ant, but still, I get this error.
Below is a section of my pom.xml where the error is:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>versionConsistency</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"/>
<xmltask source="Upgrade.xml">
<copy path="component/versions/version/#number" property="fVer" />
</xmltask>
<property name="pVer" value = "${project.version}" />
<script language="javascript">
<![CDATA[
fVer = project.getProperty('fVer');
pVer = project.getProperty('pVer');
if( fVer == pVer){
project.setProperty('isVerConsistent','true');
}else if (pVer.substring(0, pVer.search("-")) == fVer){
project.setProperty('isVerConsistent','true');
}else{
project.setProperty('isVerConsistent','false');
var fail = project.createTask("fail");
fail.setMessage("Project version and version in Upgrade.xml do not match");
fail.perform();
}
]]>
</script>
</target>
</configuration>
</execution>
</executions>

Chrome Web Store Manifest

I developed my gmail gadget to find sender email and add it to database .Hopefully I was able to see my gadget at bottom of email, and also I able to call my web Api from google.I created chrome web store app. I did some part and it works fine now. But I want to know exactly which steps I have to follow to do that?
here's my gadget.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Module>`enter code here`
<ModulePrefs title="Test Gadget"
description=""
height="20"
author="excendia"
author_email="..."
author_location="">
<!-- Declare feature dependencies. -->
<!-- This one is not specific to Gmail contextual gadgets. -->
<Require feature="dynamic-height"/>
<!-- The next feature, Caja, is optional, and is supported for
use only within test domains. Uncomment the tag only for
non-production gadgets. -->
<!-- <Require feature="caja"/> -->
<!-- The next feature, google.contentmatch, is required for all
Gmail contextual gadgets.
<Param> - specify one or more comma-separated extractor IDs in
a param named "extractors". This line is overridden by the extractor ID
in the manifest, but is still expected to be present. -->
<Require feature="google.contentmatch">
<Param name="extractors">
google.com:MessageIDExtractor
</Param>
</Require>
</ModulePrefs>
<!-- Define the content type and display location. The settings
"html" and "card" are required for all Gmail contextual gadgets. -->
<Content type="html" view="card">
<![CDATA[
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
<!-- Iterate through the array and display output for each match. -->
for (var match in matches) {
for (var key in matches[match]) {
listItem = document.createElement('LI');
extractedText = document.createTextNode(key + ": " + matches[match][key]);
listItem.appendChild(extractedText);
matchList.appendChild(listItem);
}
}
document.body.appendChild(matchList);
gadgets.window.adjustHeight(100);
</script>
]]>
</Content>
</Module>
You can find steps to create chrome web store here.

maven-jaxb2-plugin (maven) generated date and time

I'm trying to remove the generated date and time from files generated with plugin maven-jaxb2-plugin. Is-it possible?
Part of pom.xml :
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>commun-generate</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<generatePackage>my.package.dest</generatePackage>
<generateDirectory>${basedir}/src/main/java/</generateDirectory>
<schemaDirectory>${basedir}/src/main/resources/schemas/wsrest</schemaDirectory>
<bindingDirectory>${basedir}/src/main/resources/schemas/wsrest</bindingDirectory>
<bindingIncludes>
<include>bindings.xml</include>
</bindingIncludes>
<strict>false</strict>
<extension>true</extension>
<verbose>true</verbose>
</configuration>
</execution>
Begin of a generated file :
//
// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.6
// Voir http://java.sun.com/xml/jaxb
// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source.
// Généré le : 2014.03.17 à 09:42:08 AM CET
//
package my.package.dest;
...
I would like to remove this part :
Généré le : 2014.03.17 à 09:42:08 AM CET
thanks in advance
Clément
FYI noFileHeader configuration parameter is supported from 0.9.0. So you can just do
<configuration>
<noFileHeader>true</noFileHeader>
</configuration>
now.
See controlling the output section in the docs.
#lexicore's answer still works in 0.14.0 version. Simply add <noFileHeader>true</noFileHeader> in the configuration section.
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<configuration>
<noFileHeader>true</noFileHeader>
<schemaLanguage>wsdl</schemaLanguage>
<generatePackage>[...]</generatePackage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
<schemas>
<schema>
<url>[...]</url>
</schema>
</schemas>
</configuration>
I found a workaround describe here :
Skip the Generated on... in Java files using jaxb2 maven plugin
Solution? add in pom.xml, in , theses arguments : <args><arg>-no-header</arg></args>
result : no header is generated

Getting Menu Inheritance to Work in a Multi-Module Maven Site

I have a question about constructing a Maven site with a parent POM file and sub-modules. I am having trouble getting relative links in inherited module sites to work when the menu is inherited from a parent POM.
I have a project structure as follows:
modules/pom.xml
parent/
module1/
module2/
etc.
So with this configuration I end up with a site that looks like:
base-site/
module1/
module2/
The reactor build from modules/pom.xml generates the top-level website, and each of the modules also has a site generated.
Each of the modules inherits this site.xml file from the parent (for example):
<project>
<body>
<menu name="Module" inherit="top">
<item name="Summary" href="./project-summary.html"/>
</menu>
<menu name="Module" ref="reports" inherit="bottom" />
</body>
</project>
The menu referencing the standard Maven generated "reports" works fine.
But the href to project-summary.html ends up pointing back at the top site and not the child.
I have seen some similar issues on Stackoverflow having to do with constructing an inherited menu, but I did not find exact information on how to get these links to point to content in the child site and not the parent. It may be possible that I am misunderstanding what the menu inheritance is supposed to accomplish here.
Basically, I want the menu links to generated content in the child sites to look like:
<item name="Summary" href="./module1/project-summary.html"/>
Okay, so I thought, let me try to use filtering to accomplish this like from my parent POM using something like:
<item name="Summary" href="./${project.artifactId}/project-summary.html"/>
But that does not work because the parent POM's name gets substituted here instead of the child project's name.
In this case, perhaps I need site a custom site.xml for each module, but I would like to avoid this as there are something like 15 of them, and they will mostly be identical in terms of sharing about 8 or 9 different (relative) menu links. Most projects would not need their own site.xml file. So ideally I'd like the parent to define all the defaults with the child POMs adding a few additional menus.
In order to do this, am I stuck with using the "reports" ref and its default layout? Or can I list these explicitly as menu items in the parent's site.xml file and get those references to work somehow?
I hope that's clear. Thanks.
I've the same need as you.
I'll use the gmaven-plugin with a script (during the generate resource phase) that iterates in parent and copy src/site/site.xml in the current project if any.
Here's my script (Here's I'm just copying a parent site.xml file if a 'readme.md' file is present on the module):
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>execute</goal>
</goals>
<phase>pre-site</phase>
</execution>
</executions>
<configuration>
<scripts>
<script> <![CDATA[
import java.io.BufferedWriter
import java.io.File
import java.nio.charset.Charset
import java.nio.file.StandardCopyOption
import java.nio.file.Files
import java.nio.file.StandardOpenOption
String siteXmlPath = "src/site/site.xml"
String readme_file = "readme.md"
String currentPath = "${project.basedir}"
if (new File(currentPath + "/" + readme_file).exists() && !(new File(currentPath + "/" + siteXmlPath).exists())) {
while (!(new File(currentPath + "/" + siteXmlPath).exists())) {
currentPath = currentPath + "/.."
if (new File(currentPath + "/" + siteXmlPath).exists()) {
Files.copy(new File(currentPath + "/" + siteXmlPath).toPath(), new File("${project.basedir}/" + siteXmlPath).toPath(), StandardCopyOption.REPLACE_EXISTING)
File newlyCreatedFile = new File("${project.basedir}/" + siteXmlPath)
BufferedWriter newFileWriter = Files.newBufferedWriter(newlyCreatedFile.toPath(), Charset.defaultCharset(), StandardOpenOption.APPEND)
newFileWriter.append("<!-- #generated -->")
newFileWriter.close()
} else if (!(new File(currentPath + "/pom.xml").exists())) { break; }
}
} ]]>
</script>
</scripts>
</configuration>
</plugin>
Regards

Resources