gradle/gradle-jdocbook — Issue #8: Issues locating resources
Author: erichschroeter
Created: 2012-03-06 14:21:12+00:00
State: open

I have a docbook project setup similar to [the hibernate project][0] (I've been using it as an example to get up and running with this plugin). My `build.gradle` is as follows:

buildscript {
repositories {
mavenCentral()
mavenLocal()
mavenRepo name: 'jboss', url: 'http://repository.jboss.org/nexus/content/groups/public/'
}
dependencies { classpath group: 'org.jboss.jdocbook', name:'gradle-jdocbook', version: '1.1.3' }
}

apply plugin: 'jdocbook'

jdocbook {
masterLanguage = 'en-US'

format('html_single') {
finalName = 'index.html'
stylesheet = 'classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl'
}

manual {
masterSourceDocumentName = 'manual.xml'
}
}

However, I am getting errors when running the `buildDocs` task where resources cannot be located:

$ gradle :documentation:buildDocs
> Building > :documentation:stageStyles_manual > Resolving dependencies ':docume
:documentation:stageStyles_manual UP-TO-DATE
:documentation:renderDocBook_manual_en-US_html_single
Extending script classloader with the jdocbookStyles dependencies
rendering Book(manual) en-US/html_single
> Building > :documentation:renderDocBook_manual_en-US_html_single > Resolving d

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':documentation:renderDocBook_manual_en-US_html_single'.
> could not locate resource [classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl]

BUILD FAILED

The `xhtml-single.xsl` file is located in `src/main/style/xslt/org/hibernate/jdocbook/xslt/` but it still is not found. I tried just commenting out the classpath, and it appears **jdocbook** looks for a default stylesheet at `/html/docbook.xsl`. So, I tried placing a dummy `docbook.xsl` file in the following places within the project, but no matter where I put it, it was not located:

- `src/main/style/html/docbook.xsl`
- `src/main/docbook/html/docbook.xsl`
- `src/main/docbook/manual/en-US/html/docbook.xsl`
- `src/main/html/docbook.xsl`

I've tried looking at the plugin code, but I'm fairly new to Groovy and Gradle, so I don't have much confidence in evaluating it. How are resources located in the **jdocbook** plugin? Do I have to put resources in a special place?

[0]: https://github.com/hibernate/hibernate-orm