docbkx-maven-plugin: No output during run of plugin - maven

I set up the docbkx-maven-plugin to generate PDF documentation for a source project. In the parent pom I specified the version to be used as well as the reference to the docbook version to use:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.14</version>
<dependencies>
<dependency>
<groupId>net.sf.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>5.0-all</version>
<type>zip</type>
<classifier>resources</classifier>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</pluginManagement>
In the actual project I use the configuration:
<build>
<plugins>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<executions>
<execution>
<id>usersmanual</id>
<phase>generate-resources</phase>
<goals>
<goal>generate-pdf</goal>
</goals>
<configuration>
<includes>${basedir}/UserManual/*.xml</includes>
<includes>${basedir}/UserManual/src/*.xml</includes>
<targetDirectory>${project.build.directory}/UserManual</targetDirectory>
<chunkedOutput>true</chunkedOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
No matter what goal(s) I specify or what includes I provide, the plugin performs no(!) operation. There is no target directory created and I do not see any meaningful output on the command line. The result looks like:
[INFO] --- docbkx-maven-plugin:2.0.14:generate-pdf (usersmanual) # documentation ---
[INFO]
I use Maven 3.0.3.
What do I miss here? Is there any configuration not provided, yet, which will start the plugin to do some work?
UPDATE:
This is what I have now:
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.14</version>
<dependencies>
<dependency>
<groupId>net.sf.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>5.0-all</version>
<type>zip</type>
<classifier>resources</classifier>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>generate-pdf</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<sourceDirectory>${project.basedir}/UserManual</sourceDirectory>
<xincludeSupported>true</xincludeSupported>
<includes>${project.basedir}/UserManual/UserManual.xml</includes>
<includes>${project.basedir}/UserManual/**/*.xml</includes>
<targetDirectory>${project.build.directory}/UserManual</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
At least the directory target/Usermanual is greated, but it is still empty. Why is there still not output? Do I have a chance to get a meaningful log file from docbkx? mvn ... -X does not tell much.

Your latest example contains two includes configuration options which is not valid maven configuration.
My recommendation is to stop trying to override all these defaults and accept the default location for the docbook source xml, at least initially while you get comfortable with the plugin and can diagnose what issues are from what changes.
Anyway, your <includes> should be just the root xml file of the documentation you're trying to generate as it exists in the <sourceDirectory>. You do not need to include all of the xml files, you instead need to follow the xincludes approach since you're declaring its usage. There are a number of projects using this mechanism that you can review and copy the usage of.
Ours is: https://github.com/jetty-project/jetty-documentation
We have a bit more complex usage since we use the maven filtering plugin to avoid having to mess with entities and the like. Getting back to your includes usage, if your top level docbook file is index.xml then your includes would simply be:
<includes>index.xml</includes>
No expressions or globs needed, you bring in the other xml documents with the <xi:include> tags where needed.

Related

Integrate JQAssistant-Maven-Plugin with database analysis via RDBMS Plugin

I´m trying to move my existing software-analysis with jQAssistant (which is basically all steps and scripts in a textfile and executed manually) to the maven-plugin of jQAssistant in order to be able to perform the software-analysis at the build-server.
One step of the analysis is to get information about the database schema. This is done with the RDBMS-Plugin of jQAssistant.
But when i try to perform the analysis with maven the information about the database-connection seems to be lost and no database-analysis is performed at all.
The current code of the plugin-configuration looks like this:
<plugin>
<groupId>com.buschmais.jqassistant</groupId>
<artifactId>jqassistant-maven-plugin</artifactId>
<version>1.8.0</version>
<executions>
<execution>
<id>cli-default</id>
<goals>
<goal>scan</goal>
<goal>analyze</goal>
</goals>
<configuration>
<!-- Scan -->
<scanIncludes>
<scanInclude>
<url>jdbc:oracle:thin:username/password#host:1521:sid</url>
<scope>rdbms:connection</scope>
</scanInclude>
</scanIncludes>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.0</version>
</dependency>
</dependencies>
</plugin>
I couldn´t find anything in the documentation. Is this a limitation of the jqassistant-maven-plugin or is this a configuration error?

How to configure SpotBugs maven plugin to create a full report but check for high threshold only?

I have a legacy maven project and want to integrate the FindBugs successor SpotBugs to create a report of all issues but fail if there a High priority issues only (for now).
It is easy to create the report only without fail ing or to fail on a specific threshold. But when specifying a threshold all issues below that one are also removed from the report.
I have tried to configure the plugin according to to documentation but without success:
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.3</version>
<configuration>
<effort>Max</effort>
<threshold>High</threshold>
<xmlOutput>true</xmlOutput>
<spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs-reports</spotbugsXmlOutputDirectory>
<xmlOutputDirectory>${project.build.directory}/spotbugs-reports</xmlOutputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
I am using Maven 3 and SpotBugs 3.1.3.
Not sure if that helps, it's mostly a workaround.
I have a similar case and what I did was that I placed the configuration in a "reporting" tag (not reportSets). In the "build" tag, I just put the plugin information and the dependencies. The configuration used the default values for the output xml and output folder. I also added file which was filtering out some of the bugs:
<build>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.10</version>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>3.1.11</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.10</version>
<configuration>
<excludeFilterFile>spotbugs_filter.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</reporting>
I then did a
mvn clean install site spotbugs:check
This gave me:
a spotbugsXml.xml file in the build_directory containing ALL of the bugs found (no filters applied).
a report spotbugs.html was produced in target/site which contained the filtered list of bugs.
So, to link this with your issue, I guess that using these "steps" you can have two reports, one with the threshold and another one without.
Does this make sense?

liquibase maven plugin multiple changeLogFile

I'm using liquibase maven plugin to update the database changes via jenkins automated builds.
I have this in my pom.xml
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.2</version>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.5</version>
</dependency>
</dependencies>
<configuration>
<changeLogFile>${basedir}/src/main/resources/schema.sql</changeLogFile>
<changeLogFile>${basedir}/src/main/resources/data.sql</changeLogFile>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://${db.url}</url>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
</plugin>
I need to run schema.sql before data.sql. When I run this locally it works. When I run it via jenkins the schema changeLogFile executes second, so in order to make it work I reversed the commads.
Question: What's the order of execution? Am I doing something wrong?
The official goal documentation specify that only one entry is foreseen:
changeLogFile:
Specifies the change log file to use for Liquibase.
Type: java.lang.String
Required: No
Expression: ${liquibase.changeLogFile}
You can add further entries, but they will be ignored and maven will not complain: it doesn't validate plugin configuration' content, it cannot, because that part is up to the plugin and not known upfront by maven. That is, is generic.
To ensure a deterministic order and have two changeLogFile executed, you should specify several plugin executions as following:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.2</version>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.5</version>
</dependency>
</dependencies>
<configuration>
<changeLogFile>${basedir}/src/main/resources/schema.sql</changeLogFile>
<changeLogFile>${basedir}/src/main/resources/data.sql</changeLogFile>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://${db.url}</url>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<id>update-schema</id>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
<configuration>
<changeLogFile>${basedir}/src/main/resources/schema.sql</changeLogFile>
</configuration>
</execution>
<execution>
<id>update-data</id>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
<configuration>
<changeLogFile>${basedir}/src/main/resources/data.sql</changeLogFile>
</configuration>
</execution>
</executions>
</plugin>
Note: we are specifying a common configuration for all executions outside of the executions section, then per each execution we are only defining the additional configuration, which is every time the different file.
The deterministic order is guaranteed by Maven: for the same plugin, for the same phase, the order of declaration in the POM will be respected.
However, this executions will be part of your build now as part of the process-resources phase, which is probably not what you want. So in this case, better to move it to a profile as following:
<profiles>
<profile>
<id>liquibase-executions</id>
<build>
<defaultGoal>process-resources</defaultGoal>
<plugins>
<!-- MOVE HERE liquibase plugin configuration and executions -->
</plugins>
</build>
</profile>
</profiles>
And then execute the following (according also to your comment):
mvn -Pliquibase-executions -Ddb.url=IP:PORT/DB -Dliquibase.username=USERNAME

Specify javaagent argument with Maven exec plugin

I have a similar question to: this previous question
I am converting a Java project using Netbeans to Maven. In order to launch the program, one of the command-line arguments we need is the -javaagent setting. e.g.
-javaagent:lib/eclipselink.jar
I'm trying to get Netbeans to launch the application for development use (we will write custom launch scripts for final deployment)
Since I'm using Maven to manage the Eclipselink dependencies, I may not know the exact filename of the Eclipselink jar file. It may be something like eclipselink-2.1.1.jar based on the version I have configured in the pom.xml file.
How do I configure the exec-maven-plugin to pass the exact eclipselink filename to the command line argument?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Xmx1000m</argument>
<argument>-javaagent:lib/eclipselink.jar</argument> <==== HELP?
<argument>-classpath</argument>
<classpath/>
<argument>my.App</argument>
</arguments>
</configuration>
</plugin>
I figured out a way that seems to work well.
First, setup the maven-dependency-plugin to always run the "properties" goal.
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>getClasspathFilenames</id>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
Later on, use the property it sets as documented here with the form:
groupId:artifactId:type:[classifier]
e.g.
<argument>-javaagent:${mygroup:eclipselink:jar}</argument>
Simply define a property for the eclipse link version and use the property in your <dependency> and the exec plugin:
<properties>
<eclipselink.version>2.4.0</eclipselink.version>
</properties>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>${eclipselink.version}</version>
</dependency>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<arguments>
<argument>-Xmx1000m</argument>
<argument>-javaagent:lib/eclipselink-${eclipselink.version}.jar</argument>
<argument>-classpath</argument>
<classpath/>
<argument>my.App</argument>
</arguments>
</configuration>
</plugin>
the maven-dependency-plugin and exec-maven-plugin should be put under the node ,otherwise it will not work

Generating Multiple TLDs With Maven Javadoc Plugin & TLDGen

I've got a taglib project that I use the TLDGen library to help build my TLD files from annotations in my classes. I've then got it plugged into the Maven JavaDoc plugin to have it build the TLD files via the javadoc:javadoc Maven goal. Pom portion that handles this is as follows:
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<doclet>org.tldgen.TldDoclet</doclet>
<docletArtifact>
<groupId>com.google.code.tldgen</groupId>
<artifactId>tldgen-all</artifactId>
<version>1.0.0</version>
</docletArtifact>
<show>private</show>
<additionalparam>-name test
-uri "http://www.mycompany.com/tags/wibble"
-tldFile ..\..\..\src\main\resources\META-INF\w.tld
</additionalparam>
<useStandardDocletOptions>true</useStandardDocletOptions>
<author>false</author>
<encoding>utf-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
And this works fantastically. Trouble is that I know want to create 2 TLD's from this project. I can pass a -subpackages attribute in th addtionalparam element so I can produce a TLD with exactly what I want.
But I can only have one configuration element at that point. I've tried moving the configuration into the reporting section in my pom with two reportsets to see if that helps but no luck.
Has anyone ever attempted this before and can help point me in the right direction for getting it right? Cheers!
It's been a while since this question was posted, but here's how I did multiple tld generation with TLDGen. I started from your question, since the guys over at the project used your answer as a reference :).
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<includes>
<include>**</include>
</includes>
<doclet>org.tldgen.TldDoclet</doclet>
<docletArtifacts>
<!-- listing all dependencies for tldgen:
the tldgen library, commons-logging, commons-io,
commons-lang, geronimo-jsp_2.1_spec, log4j, saxon, stax
not sure if they have to be listed here, will have to check; if I
don't set them I get class not found errors, but I'm guessing I
have a misconfiguration -->
</docletArtifacts>
<show>private</show>
<additionalparam>
-htmlFolder ${basedir}/target/docs
-tldFolder ${basedir}/src/main/java/META-INF
-license NONE
</additionalparam>
<useStandardDocletOptions>true</useStandardDocletOptions>
<author>false</author>
<encoding>utf-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>

Resources