Skip to content

Conversation

@infotexture
Copy link
Member

@infotexture infotexture commented Nov 16, 2025

Description

Test jyjeanne/dita-ot-gradle per dita-ot/discussions/4722 & jyjeanne/dita-ot-gradle#quick-migration-tldr.

Motivation and Context

Confirm whether the new jyjeanne/dita-ot-gradle Gradle plugin works in our environment to take advantage of recent Gradle features that are not supported by the original eerohele/dita-ot-gradle plugin.

How Has This Been Tested?

  1. Update build.gradle in Refactor for Gradle 9 compatibility #644
  2. Update modified build.gradle@e11be3b to use jyjeanne/dita-ot-gradle

Result

❌ Build fails:

FAILURE: Build failed with an exception.

* Where:
Build file '/path/to/docs/build.gradle' line: 45

* What went wrong:
A problem occurred evaluating root project 'docs'.
> Could not get unknown property 'ditaOt' for root project 'docs' of type org.gradle.api.Project.

@infotexture infotexture self-assigned this Nov 16, 2025
@infotexture infotexture added the build Ant/Gradle build scripts & CI/CD issues label Nov 16, 2025

// Set DITA-OT directory: pass as parameter -PditaHome or fall back to parent when run in core repo.
ditaOt.dir ditaHome
// > Could not get unknown property 'ditaOt' for root project 'docs' of type org.gradle.api.Project.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jyjeanne I usually run the default docs build task and pass the path to DITA-OT on the CLI like this:

./gradlew -PditaHome=../dita-ot/src/main

Any idea why this is failing? 🤔

Copy link

@jyjeanne jyjeanne Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infotexture The migration from the eerohele Gradle plugin to the new Gradle plugin introduced an API incompatibility. The two plugins have different configuration approaches:

eerohele Plugin (v0.7.1) - Old API

plugins {
    id 'com.github.eerohele.dita-ot-gradle' version '0.7.1'
}

// Global DITA-OT directory configuration
ditaOt.dir ditaHome

jyjeanne Plugin (v2.2.2) - New API

plugins {
    id 'io.github.jyjeanne.dita-ot-gradle' version '2.2.2'
}

// DITA-OT must be configured per-task, not globally
task pdf(type: DitaOtTask) {
    ditaOt file(findProperty('ditaHome') ?: ditaHome)
    input 'my.ditamap'
    transtype 'pdf'
}

The Issue: Line 45 of build.gradle was still using the old eerohele API (ditaOt.dir), but the new jyjeanne plugin doesn't provide a root-level ditaOt extension.The ditaOt extension is no longer available at the root level. Each DitaOtTask must now explicitly configure its own DITA-OT directory..The ditaOt property expects a File object, not a String. The jyjeanne plugin is stricter about types than the old eerohele plugin.

Solution

File: build.gradle

Updated all four DitaOtTasks with the correct File type conversion:

1. pdf task (line 100):

task pdf(type: DitaOtTask, dependsOn: autoGenerate) {
    ditaOt file(findProperty('ditaHome') ?: ditaHome)  
    input "${projectDirPath}/userguide-book.ditamap"
    output outputDir
    transtype 'pdf'
    filter "${projectDirPath}/resources/pdf.ditaval"
    // ... properties ...
}

2. html task (line 116):

task html(type: DitaOtTask, dependsOn: autoGenerate) {
    ditaOt file(findProperty('ditaHome') ?: ditaHome)  
    input "${projectDirPath}/userguide.ditamap"
    output outputDir
    transtype 'html5'
    filter "${projectDirPath}/resources/html.ditaval"
    // ... properties ...
}

3. htmlhelp task (line 136):

task htmlhelp(type: DitaOtTask, dependsOn: autoGenerate) {
    ditaOt file(findProperty('ditaHome') ?: ditaHome) 
    input "${projectDirPath}/userguide.ditamap"
    output outputDir
    transtype 'htmlhelp'
    filter ditavalFile
    // ... properties ...
}

4. site task (line 202):

task site(type: DitaOtTask) {
    ditaOt file(findProperty('ditaHome') ?: ditaHome)  
    dependsOn 'messages', 'params', 'extensionPoints', 'gitMetadata'

    input file("${projectDirPath}/site.ditamap")
    output getPropertyOrDefault('outputDir', "${buildDir}/site")
    filter "${projectDirPath}/resources/site.ditaval"
    // ... properties ...
}

Verification & Testing Results

Test 1: Configuration Validation ✅

$ ./gradlew build --dry-run
✅ BUILD SUCCESSFUL in 5s

Confirmed that Gradle configuration is correct and all tasks are recognized.

Test 2: With Gradle Property Parameter ✅

$ ./gradlew -PditaHome="C:\dita-ot\dita-ot-4.3.5" build --dry-run
✅ BUILD SUCCESSFUL in 4s

Confirmed that the file() wrapper correctly converts the string path to a File object.

Test 3: Full Build Execution ✅

$ ./gradlew -PditaHome="C:\dita-ot\dita-ot-4.3.5" --no-configuration-cache
✅ Configuration: SUCCESSFUL ✅
✅ autoGenerate task: SUCCESSFUL ✅
✅ pdf task: Started correctly
✅ html task: Started correctly (reached DITA-OT execution)

Why This Matters

The migration to new plugin was necessary to support Gradle 8 & 9 compatibility with proper deprecation fixes. The new plugin has a more explicit, per-task configuration model which is:

  • More flexible: Different tasks can use different DITA-OT versions if needed
  • More transparent: Each task clearly declares its dependencies

NB : i still have some imcompatibility on gradle cache configuration

@infotexture I have tested directly on docs project this bug fix , can you hear me if it works on your side ?

@jyjeanne
Copy link

@infotexture i made some improvment on latest version 2.30 and solve problem on cache configuration , can you try with this new version of the plugin : https://github.com/jyjeanne/dita-ot-gradle/releases/tag/v2.3.0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Ant/Gradle build scripts & CI/CD issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants