How to disable "Test Source Xref" - maven

I'm using Maven Site Plugin to generate my project page. I want to publish sources also. So I used JXR Plugin. Does anybody know if it is possible to disable "Test Source Xref" report. I've only found this page http://jira.codehaus.org/browse/JXR-47 but this parameter doesn't seem to be working.
My configuration in POM looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
<configuration>
<suppressTestXref>true</suppressTestXref>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>

suppressTestXref is not available anymore. The way to do this is:
<project ...>
...
<reporting>
...
<plugins>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
<reportSets>
<reportSet>
<reports>
<report>jxr</report>
</reports>
</reportSet>
</reportSets>
</plugin>
AFAIK this is not documented anywhere :)

Related

How can I exclude certain overlay-derived directories from my war using maven?

We build a webapp using maven 3.5.0 and the maven-war-plugin. We have many overlays, many of which have a tests directory that contains JSP files used for testing certain things in a dev environment. We don't want these included in our war.
We tried the following:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<overlays>...</overlays>
<warSourceExcludes>tests</warSourceExcludes>
</configuration>
</plugin>
This didn't work, nor did a couple of configuration variations:
<packagingExcludes>tests</packagingExcludes>
and
<packagingExcludes>**/${project.artifactId}/tests/**</packagingExcludes>
Is this due to my naive misuse of configuration options, or does it have to do with how overlays are processed?
You should use <excludes>..</excludes> (see https://maven.apache.org/plugins/maven-war-plugin/overlays.html) instead of <packagingExcludes>..</packagingExclude>...
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<overlays>
<overlay>
<groupId>com.example.projects</groupId>
<artifactId>documentedprojectdependency</artifactId>
<excludes>
<exclude>WEB-INF/classes/images/sampleimage-dependency.jpg</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
...
The dependentWarExcludes element worked to eliminate the tests directories and their contents:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<overlays>...</overlays>
<dependentWarExcludes>tests/**</dependentWarExcludes>
</configuration>
</plugin>

Run maven project-info-reports:dependencies with a pom.xml

I want to include my dependencies.html into a warfile in a multi module project. When i run mvn project-info-reports:dependencies the folder site gets created with the dependencies.html file in it. Is there a way to do this with a pom.xml file?
Things that did not work have been:
<build>
<finalName>some-module</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>dependencies</id>
<goals>
<goal>dependencies</goal>
</goals>
...
or this one:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<configuration>
<skip>true</skip>
</configuration>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>dependencies</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<build>
<finalName>some-module</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>dependencies</id>
<goals>
<goal>site</goal>
</goals>
...
There is no error message in the logs, it just gets skipped. Am i doing something wrong here or is it just not meant to execute with the pom.xml?

How to get the icons for the resulted maven-surefire-report-plugin

I'm using maven-surefire-report-plugin in order to generate the unit tests report.
This is working fine however the report contains links to images which are not presented.
How can I make maven copy the icons required for the report?
Should I use skin? I tried it without success.
Here is the maven-surefire-report-plugin definition:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
<configuration>
<showSuccess>true</showSuccess>
</configuration>
</plugin>
</plugins>
</reporting>
I tried to add skin plugin but it didn't affect the report:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-application-skin</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
What is missing to present the report with the images?
The question is probably too old, but I had the same problem and I found this answer.
The command mvn site -DgenerateReports=false generates only css and images for surefire-report.html and works fine.
You must genereate the site using the Site Plugin:
mvn site
If you have already generated the reports, then you can speed this up by skipping this:
mvn site -DgenerateReports=false
mvn site -DgenerateReports=false
I did it like this, but it's a hack:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<testSourceDirectory>src/test/java</testSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<linkXRef>false</linkXRef>
<showSuccess>true</showSuccess>
</configuration>
<executions>
<execution>
<id>generate-test-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/src/test/resources/css</directory>
<targetPath>${project.build.directory}/site/css</targetPath>
<includes>
<include>*.css</include>
</includes>
</resource>
</resources>
</build>

Maven : generate only report

i have this POM.xml
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<reportSets>
<reportSet>
<reports>
<report>pmd</report>
<report>cpd</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.14</version>
</plugin>
</plugins>
when I use mvn site ,it generate for me a fuuly website but what i want is to generate only reports.
who can help me by providing a command that do this job?

pom changes needed to get JIRA link

How do I configure my changes.xml and pom file in order to link JIRA issue on the maven site.
I am including the maven-changes plugin. But I want to see how do we add for JIRA as I add the following for bugzilla.
JIRA
https://bugs.abc.corp/enter_bug.cgi?product=${project.groupId}&component=${project.artifactId}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.2</version>
<configuration>
<issueLinkTemplatePerSystem>
<bugzilla><![CDATA[http://internal.bugtracker/show_bug.cgi?id=%ISSUE%]]></bugzilla>
<navigator><![CDATA[http://external.bugtracker/?cr=%ISSUE%]]></navigator>
</issueLinkTemplatePerSystem>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
Of course, it is a great idea to take a look at the docs, as Raghuram suggested. JIRA is one of the pre-configured systems, and its standard URL for issues is %URL%/%ISSUE%.
From the XML snippet I understand you have added the issueLinkTemplatePerSystem configuration in the reporting section of the pom file. I have been struggling with this until I have tried adding that configuration to the pluginManagement section instead:
<project>
<!-- ... -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.9</version>
<configuration>
<issueLinkTemplatePerSystem>
<system1>https://a.b.c/ticket?id=%ISSUE%</system1>
<system2>https://foo.bar/baz/%ISSUE%/view</system2>
</issueLinkTemplatePerSystem>
</configuration>
</plugin>
<!-- ... -->
</plugins>
</pluginManagement>
<!-- ... -->
</build>
<!-- ... -->
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<!-- ... -->
</project>
Then it worked like a charm, being able to use several different systems (with different template URLs) in changes.xml. I did not find this in the documentation.
Hint: try adding the option --debug (mvn --debug clean changes:changes-report) to see the IMSs taken by the plugin from the configuration.
Perhaps you should try the steps documented in Linking to Your Issue Management System section of the usage page of the plugin.
According to it, from version 2.4, the plugin comes pre-configured for a bunch of issue tracking systems, including jira. Quoting from the page,
If you use the issue attribute in your changes.xml file and have the
element configured in your pom.xml, the report will
contain links to the issues in your issue management system.
This is how I got it working for bugzilla and jira. So you just need to add an extra row -
You may put the url instead of the variable "%"
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.9</version>
<configuration>
<issueLinkTemplatePerSystem>
<jira><![CDATA[%URL%/browse/%ISSUE%]]></jira>
<bugzilla><![CDATA[http://bugzill.url/show_bug.cgi?id=%ISSUE%]]></bugzilla>
</issueLinkTemplatePerSystem>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

Resources