Gradle Java2HTML plugin

Java2HTML Logo

The plugin uses Java2Html Ant task to convert Java (and other) source code (complete files or snippets) to HTML, RTF, TeX and XHTML with syntax highlighting. The task is only available to projects that apply the Java or Groovy plugin.


To use the Java2HTML plugin, include in your build script:

apply plugin: 'com.bmuschko.java2html'

The plugin JAR needs to be defined in the classpath of your build script. It is directly available on Bintray. Alternatively, you can download it from GitHub and deploy it to your local repository. The following code snippet shows an example on how to retrieve it from Bintray:

buildscript {
    repositories {

    dependencies {
        classpath 'com.bmuschko:gradle-java2html-plugin:2.0'

To define the Java2HTML dependency please use the java2html configuration name in your dependencies closure.

dependencies {
    java2html 'de.java2html:java2html:5.0'


The Java2HTML plugin defines the following tasks:

Extension properties

The Java2HTML plugin defines the following convention properties in the java2html closure. This closure itself contains two closures for each of the tasks: conversion and overview.

In the closure conversion you can define property values for converting the source code:

In the closure overview you can define property values for generating the HTML overview files:


java2html {
    conversion {
        tabs = 4
        style = 'eclipse'
        showFileName = true
        useShortFileName = true
        override = true
        showDefaultTitle = true

    overview {
        docDescription = 'Gradle plugin for turning source code into HTML, RTF, TeX and XHTML using Java2HTML.'