Include JAXB using Maven

后端 未结 3 570
醉酒成梦
醉酒成梦 2020-12-30 06:08

Working on my 1.6.0_16 JDK, I generated my stub classes from a WSDL using Apache CXF 2.5.2, which uses the most recent jaxb-api 2.2. I know it\'s possible to have it use jax

相关标签:
3条回答
  • 2020-12-30 06:30

    I just ran into this issue with jaxb also; goodness do I love Maven (not). Here's how I resolved the problem.

    Add the central repo

    <repository>
        <id>central</id>
        <url>http://repo.maven.apache.org/maven2/</url>
    </repository>
    

    Modify the version of the api and impl

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.5-b10</version>
    </dependency>
    
    0 讨论(0)
  • 2020-12-30 06:33

    Add

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.12</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.11</version>
    </dependency>
    

    and

    <repositories>
        <repository>
            <id>central</id>
            <url>http://repo.maven.apache.org/maven2/</url>
        </repository>
    </repositories>
    
    0 讨论(0)
  • 2020-12-30 06:34

    FYI: Both Paul and Do Nhu Vy's answers are correct, but if you encountered error message like below, please change repository to HTTPS:

    [ERROR] Failed to execute goal on project hibernate: Could not resolve dependencies for project edu.baylor.cs.se:hibernate:jar:1.0-SNAPSHOT: Failed to collect dependencies at javax.xml.bind:jaxb-api:jar:2.2.7: Failed to read artifact descriptor for javax
    .xml.bind:jaxb-api:jar:2.2.7: Could not transfer artifact javax.xml.bind:jaxb-api:pom:2.2.7 from/to central (http://repo.maven.apache.org/maven2/): Transfer failed for http://repo.maven.apache.org/maven2/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.pom 5
    01 HTTPS Required -> [Help 1]
    

    Add those in pom.xml file.

        <repositories>
            <repository>
                <id>central</id>
                <url>https://repo.maven.apache.org/maven2/</url>
            </repository>
        </repositories>
    
        <dependencies>
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.2.9</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>2.2.5-b10</version>
            </dependency>
        </dependencies>
    
    0 讨论(0)
提交回复
热议问题