gradle / gradle-jdocbook

A Gradle plugin for jdocbook
13 stars 14 forks source link

task with that name already exists #7

Closed erichschroeter closed 12 years ago

erichschroeter commented 12 years ago

I have a gradle file I created using your sample files as an example

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 {
  masterSourceDocumentName = 'manual.xml'
  translation 'en-US'

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

but am getting the following error:

$ gradle :documentation:userguide:buildDocs

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\project\documentation\userguide\build.gradle' line: 12

* What went wrong:
A problem occurred evaluating project ':documentation:userguide'.
> Failed to notify action.
   > Cannot add task ':documentation:userguide:renderDocBook_en-US_html_single' as a task with that name already exists.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6.157 secs

I know I haven't manually created a renderDocBook_en-US-html_single task, so I am guessing the plugin generates it. Am I missing something in my gradle file? Any suggestions?

stliu commented 12 years ago

either use

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

or

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

I also had to remove the translation 'en-US' to not receive the error.

stliu commented 12 years ago

if your masterLanguage is not 'en-US', you need give set this property as well, and you can use translation=['en-US'] syntax