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

error: package jakarta.xml.bind.annotation does not exist #266

Closed
ctwoolsey opened this issue Oct 20, 2022 · 1 comment
Closed

error: package jakarta.xml.bind.annotation does not exist #266

ctwoolsey opened this issue Oct 20, 2022 · 1 comment

Comments

@ctwoolsey
Copy link

I'm not sure if this is an error or a documentation issue.
I'm upgrading to Java 17 Gradle 7.4.1 and after multiple attempts to get wsimport working, I succeeded. However, when building the project, I get an error:
error: package jakarta.xml.bind.annotation does not exist import jakarta.xml.bind.annotation.XmlAccessType;
This follows for all different annotations XmlAccessorType, XmlElement, XmlRootElement, XmlType...

I don't know if this is related to a mapping issue like: #179
Here is my gradle file with the appropriate sections shown:

plugins {
    id 'idea'
    id 'groovy'
    id 'codenarc'
    id 'maven-publish'
    id 'org.springframework.boot' version '2.6.4'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}

group = 'com.mygroup'
sourceCompatibility = JavaVersion.VERSION_17

repositories {
    mavenCentral()
}

ext['groovy.version'] = '3.0.10'

configurations {
    jaxws
}

dependencies {
    ...
    jaxws('com.sun.xml.ws:jaxws-tools:4.0.0')
    jaxws('jakarta.xml.ws:jakarta.xml.ws-api:4.0.0')
    jaxws('jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
    jaxws('jakarta.activation:jakarta.activation-api:2.1.0')
    jaxws('com.sun.xml.ws:jaxws-rt:4.0.0')
}

task wsimport {
    description = 'Generate classes from wsdl using wsimport'

    def wsdlFile = file("${projectDir}/src/main/resources/wsdl/myWsdl.wsdl")
    def bindingFile = file("${projectDir}/src/main/resources/wsdl/myWsdl.xjb")
    ext.classesDir = "${projectDir}/src/main/java/"

    doLast {
        ant {
            mkdir(dir: classesDir)

            taskdef(name: 'wsimport',
                classname: 'com.sun.tools.ws.ant.WsImport',
                classpath: configurations.jaxws.asPath
            )
            wsimport(
                destdir: "${classesDir}",
                sourcedestdir: "${classesDir}",
                extension: "true",
                verbose: "false",
                quiet: "false",
                package: "generated.soap.models",
                xnocompile: "true",
                binding: "${bindingFile}",
                wsdl: "${wsdlFile}")
        }
    }
}


compileJava {
    dependsOn wsimport
    source wsimport.classesDir
}
...
@ctwoolsey
Copy link
Author

ctwoolsey commented Oct 21, 2022

If I add:

implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
implementation 'jakarta.xml.ws:jakarta.xml.ws-api:4.0.0'

To the dependencies, this problem is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant