-
-
Notifications
You must be signed in to change notification settings - Fork 304
Gradle Build Customizations
The following snippets show various ways to customize the default Bnd Workspace Gradle build.
The built-in 'javadoc' task in Gradle works fine and generates documentation under the generated/docs directory. However by default it generates javadocs for all packages, including private packages which are not API. The following snippet allows us to generate javadocs only for exported packages, which are assumed to be public API.
Note that this script assumes the Export-Package statement only contains a simple list of package names. If wildcards, directives or other features are used then the processing of the statement will have to be more complicated.
To use, first insert the following into build.gradle at the project root:
subprojects {
if (plugins.hasPlugin('biz.aQute.bnd')) {
apply from: cnf.file('gradle/javadoc.gradle')
}
}Now create the file cnf/gradle/javadoc.gradle as follows:
/*
* Generate JavaDocs only for exported packages
*/
ext.javadocSpecs = bnd('Export-Package', project.name)
/*
* Allow projects to set the JavaDoc page title with a 'javadoc.title' field in their
* bnd.bnd file. Otherwise the project name is used
*/
ext.javadocTitle = bnd('javadoc.title', project.name)
javadoc {
source bnd.allSrcDirs
javadocSpecs.split(/\s*,\s*/).each {
include it.replace('.','/')+'/*.java'
}
configure(options) {
docTitle = javadocTitle
windowTitle = javadocTitle
memberLevel = JavadocMemberLevel.PROTECTED
charSet = 'UTF-8'
encoding = 'UTF-8'
docEncoding = 'UTF-8'
use = true
splitIndex = true
noDeprecated = false
noDeprecatedList = false
noIndex = false
noNavBar = false
noTree = false
links('http://docs.oracle.com/javase/8/docs/api/')
}
/* Turn off javadoc 8 overly pedantic lint checking */
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
doFirst {
project.delete(destinationDir)
logger.info "Title : ${options.windowTitle}"
logger.info "Packages : ${javadocSpecs}"
logger.info "Destdir : ${destinationDir}"
}
}Latest Releases
all versions
- 7.1.0 | 7.0.0
- 6.4.1 | 6.4.0 | 6.3.1 | 6.3.0
- 6.2.0 | 6.1.0 | 6.0.0
- 5.3.0 | 5.2.0 | 5.1.2 | 5.1.1
- 5.1.0 | 5.0.1 | 5.0.0
- 4.3.1 | 4.3.0 | 4.2.1 | 4.2.0
- 4.1.0 | 4.0.0
- 3.5.0 | 3.4.0 | 3.3.0 | 3.2.0
- 2.2.0
Gradle
- Plugin
- Build Customizations
- Builder & java-library
- Non-Workspace builds
- PluginManagement
- Using Kotlin
- Kotlin DSL jar config
- AntTasks
- Baselining [beta]
- Blurry Form Text on High-Resolution Displays
- Bnd toolchain parity table
- bnddistribute
- Buildpath Versions
- Conflict with M2E PDE Connector
- Eclipse Logging with Logback
- Hackathon June 2012
- Install bnd on the command line
- Is there a mailing list for bnd
- Launching Framework
- Multi-project build order
- Multi-release JAR support design discussion
- Plans wrt to enRoute
- Reading Eclipse project preferences in bnd
- Release Process
- Requirements for New Repository API
- Windows Locked Files
- WIP ideas ‐ bnd 8.0.0 breaking changes
- XML Attributes on Annotations
- [ant] Loading and Expanding Shared Headers or Properties