简体   繁体   中英

maven jaxb2 plugin - can I avoid jwsdp dependencies

I have a maven build which auto-generates a set JAXB java source files. The basic config is

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.7.5</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <includeSchemas>
            <includeSchema>*.xsd</includeSchema>
        </includeSchemas>
        <excludeSchemas>
            <excludeSchema>test*.xsd</excludeSchema>
        </excludeSchemas>
        <includeBindings>
            <includeBinding>*.xjb</includeBinding>
        </includeBindings>
        <strict>false</strict>
        <verbose>true</verbose>
        <debug>true</debug>
        <extension>true</extension>
        <!-- http://stackoverflow.com/questions/1999163/how-to-use-jaxb-commons-plugins-from-maven -->
        <args>
            <arg>-Xinheritance</arg>
        </args>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics</artifactId>
            <version>0.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-runtime</artifactId>
            <version>0.6.1</version>
        </dependency>
    </dependencies>
</plugin>

If i run 'maven clean package' the source files are correctly generated but process goes onto to try and downloaded these jars. I realise I can manually install the required jars from the instructions outlined on the Maven JAXB Plug-in page, but I'm wondering is there an alternative way to avoid the sun web service jar dependencies. Should i use different versions for the JAXP or maven plugins?.

Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-api/jwsdp.1.5/jaxb-api-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-api:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-impl/jwsdp.1.5/jaxb-impl-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-impl:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-xjc/jwsdp.1.5/jaxb-xjc-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-xjc:pom:jwsdp.1.5' in repository java.net2 (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-libs:pom:jwsdp.1.5' in repository central (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom
[INFO] Unable to find resource 'jwsdp:jaxb-libs:pom:jwsdp.1.5' in repository java.net (http://host/archiva/repository/internal)
Downloading: http://host/archiva/repository/internal/jwsdp/jaxb-libs/jwsdp.1.5/jaxb-libs-jwsdp.1.5.pom

I don't understand where do you get these jwsdp:jaxb-libs dependencies from. How do you come to the idea that you need them? Maybe one of these sample projects may be helpful to get you started. Your projects noramlly have

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>${jaxb.version}</version>
    </dependency>

as dependency. If you're using JAXB2 Basics then you'll also need:

    <dependency>
        <groupId>org.jvnet.jaxb2_commons</groupId>
        <artifactId>jaxb2-basics-runtime</artifactId>
        <version>${project.version}</version>
    </dependency>

You normally don't need jwsdp as dependency. But maybe I'm missing something.

Next, this plugin: http://maven-plugins.sourceforge.net/maven-jaxb-plugin/ does not have anything to do with maven-jaxb2-plugin you are using.

Finally, I recommend adding JAXB plugins as configuration/plugins , not as dependencies. See this guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM