0

我有一个自动生成一组 JAXB java 源文件的 Maven 构建。基本配置是

<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>

如果我运行“maven clean package”,源文件会正确生成,但过程会继续尝试下载这些 jar。我意识到我可以按照Maven JAXB 插件页面上列出的说明手动安装所需的 jar ,但我想知道是否有另一种方法可以避免 sun web 服务 jar 依赖项。我应该为 JAXP 或 maven 插件使用不同的版本吗?

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
4

1 回答 1

1

我不明白您从哪里获得这些jwsdp:jaxb-libs依赖项。你是怎么想到你需要它们的?也许这些示例项目之一可能有助于您入门。您的项目通常有

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

作为依赖。如果您使用的是 JAXB2 Basics,那么您还需要:

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

您通常不需要 jwsdp 作为依赖项。但也许我错过了一些东西。

接下来,这个插件:httpmaven-jaxb2-plugin ://maven-plugins.sourceforge.net/maven-jaxb-plugin/ 和你正在使用没有任何关系。

最后,我建议将 JAXB 插件添加为configuration/plugins,而不是依赖项。请参阅本指南

于 2011-06-26T12:00:35.740 回答