Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with JDK 21 and Gradle 8.11 #8

Open
manoelcampos opened this issue Dec 12, 2024 · 0 comments
Open

Doesn't work with JDK 21 and Gradle 8.11 #8

manoelcampos opened this issue Dec 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@manoelcampos
Copy link

Expected and Results

I'd expect the project to build with JDK 21 and Gradle 8.11 after running ./gradlew clean build

Related environent and versions

The README shows utilization for jaxb2 dependencies 0.9.5, but current versions are:

  • org.jvnet.jaxb2_commons:jaxb2-basics-ant:1.11.1
  • org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1
  • org.jvnet.jaxb2_commons:jaxb2-basics-runtime:2.0.12 (there is a 1.11.1 version, but it doesn't work either)

I'm using com.github.gradlecommunity.jaxb2 version 3.1.0

Reproduction steps

If I use org.jvnet.jaxb2_commons:jaxb2-basics-runtime:2.0.12 I get the error:

Execution failed for task ':generateJaxb2Classes'.
java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider org.jvnet.jaxb2_commons.plugin.tostring.ToStringPlugin could not be instantiated

If I used org.jvnet.jaxb2_commons:jaxb2-basics-runtime:1.11.1 I get the error:

Execution failed for task ':generateJaxb2Classes'.
java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: com.sun.tools.xjc.addon.accessors.PluginImpl Unable to get public no-arg constructor

Anything else?

This is a snippet of my build.gradle file:

plugins {
    // other plugins

    id("com.github.gradlecommunity.jaxb2") version "3.1.0"
}

dependencies {
    // other dependencies
    api 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'

    api 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
    api 'javax.activation:javax.activation-api:1.2.0'

    // default JAXB2 libs added by the com.github.gradlecommunity.jaxb2 plugin (https://github.com/GradleUp/jaxb2)
    jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:2.0.12'
    jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:1.11.1'
    jaxb2 'org.jvnet.jaxb2_commons:jaxb2-basics:1.11.1'

    jaxb2 'org.glassfish.jaxb:jaxb-xjc:4.0.5'
    jaxb2 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
    jaxb2 'javax.activation:javax.activation-api:1.2.0'

    // Java Doc in XML Format
    xmlDoclet 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
    xmlDoclet 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
    xmlDoclet 'javax.activation:javax.activation-api:1.2.0'
    xmlDoclet 'com.manticore-projects.tools:xml-doclet:+'
}

java {
    withSourcesJar()
    withJavadocJar()

    sourceCompatibility(JavaVersion.VERSION_21)
    targetCompatibility(JavaVersion.VERSION_21)

    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

jaxb2 {
    // JAXB XJC: JAXB Binding Compiler
    xjc {
      'xmldoclet-classes' {
        basePackage = 'com.github.markusbernhardt.xmldoclet.xjc'
        schema = 'src/main/xjc/javadoc.xsd'
        encoding = 'UTF-8'
        generatedSourcesDir = "${project.layout.buildDirectory}/generated/sources/java/main/xjc"
        additionalArgs = '-extension'
      }
    }
}

The entire config is at https://github.com/manoelcampos/xml-doclet/blob/master/build.gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant