Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Maven包含JAXB_Maven_Jaxb_Java_Dependency Management - Fatal编程技术网

使用Maven包含JAXB

使用Maven包含JAXB,maven,jaxb,java,dependency-management,Maven,Jaxb,Java,Dependency Management,在处理我的1.6.0_16 JDK时,我使用ApacheCXF2.5.2从WSDL生成了存根类,它使用了最新的jaxb api 2.2。我知道可以让它使用jaxb api 2.1,但为了避免兼容性问题,我宁愿让它使用当前版本。由于我的JDK具有jaxb 2.1的特性,因此构建失败,并显示以下消息: error at @XmlElementRef(name = "protocol", namespace = "urn:ch.beo.emc", type = JAXBElement.class, r

在处理我的1.6.0_16 JDK时,我使用ApacheCXF2.5.2从WSDL生成了存根类,它使用了最新的jaxb api 2.2。我知道可以让它使用jaxb api 2.1,但为了避免兼容性问题,我宁愿让它使用当前版本。由于我的JDK具有jaxb 2.1的特性,因此构建失败,并显示以下消息:

error at @XmlElementRef(name = "protocol", namespace = "urn:ch.beo.emc", type = JAXBElement.class, required = false)
因此,我尝试使用以下依赖项使maven包含最新的jaxb api和impl

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

javax.xml.bind
jaxb api
2.2.5
com.sun.xml.bind
jaxb impl
2.2.5
虽然这两个JAR已经添加到Eclipse中的Maven依赖项中,但错误消息仍然存在于Eclipse和Maven build中

如何在Maven构建中包含这些JAR,并在Eclipse和目标系统中使用它们


PS:请在此处找到完整的POM:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ch.beo</groupId>
    <artifactId>emc.front</artifactId>
    <version>3.1.3-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>jboss</id>
            <name>JBoss</name>
            <url>http://repository.jboss.org/maven2/</url>
        </repository>
        <repository>
            <id>freehep</id>
            <name>Freehep</name>
            <url>http://java.freehep.org/maven2</url>
        </repository>
        <repository>
            <id>JCurl</id>
            <url>http://jcurl.berlios.de/m2/repo</url>
        </repository>
        <repository>
            <id>JavaNet</id>
            <url>http://download.java.net/maven/2/</url>
        </repository>
        <repository>
            <id>djmaven2</id>
            <url>http://www.fdvs.com.ar/djmaven2</url>
            <name>DynamicJasper public Repository</name>
        </repository>
    </repositories>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <build>
        <defaultGoal>compile</defaultGoal>
        <sourceDirectory>src/main/java</sourceDirectory>
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <outputDirectory>target/main</outputDirectory>
        <testOutputDirectory>target/test</testOutputDirectory>
        <resources>
            <resource>
                <targetPath>ch/beo/emc/front/resources</targetPath>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>src/main/resources/security/jarsign</exclude>
                </excludes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <targetPath>ch/beo/emc/front/resources</targetPath>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <targetPath>ch/beo/emc/front/resources</targetPath>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>src/main/resources/security/jarsign</exclude>
                </excludes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                    <complianceLevel>1.6</complianceLevel>
                    <aspectLibraries>
                        <aspectLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-aspects</artifactId>
                        </aspectLibrary>
                    </aspectLibraries>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>ch.beo.emc.front.factory.Front</mainClass>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib</classpathPrefix>
                        </manifest>
                    </archive>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>ch/beo/emc/front/AllTests.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>ch.beo.emc.front.factory.Front</mainClass>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.handlers</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.schemas</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sign</id>
                        <phase>package</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <keystore>src/main/resources/security/jarsign/server.pfx</keystore>
                            <type>pkcs12</type>
                            <alias>beo-it.ch</alias>
                            <storepass>****</storepass>
                            <signedjar>${project.build.directory}/signed/${project.build.finalName}.jar</signedjar>
                            <verify>true</verify>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.l2fprod</groupId>
            <artifactId>l2fprod-common-all</artifactId>
            <version>6.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.swixml</groupId>
            <artifactId>swixml</artifactId>
            <version>1.5.144</version>
        </dependency>
        <dependency>
            <groupId>net.java.balloontip</groupId>
            <artifactId>balloontip</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.swinglabs</groupId>
            <artifactId>swingx</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>2.5.6.SEC01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>2.5.6.SEC01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>2.5.6.SEC01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>2.5.6.SEC01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>2.5.6.SEC01</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>2.5.6.SEC01</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>junit</artifactId>
                    <groupId>junit</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jfree</groupId>
            <artifactId>jfreechart</artifactId>
            <version>1.0.9</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.java.jnlp</groupId>
            <artifactId>jnlp</artifactId>
            <version>6.0</version>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>org.jscience</groupId>
            <artifactId>jsr-275</artifactId>
            <version>0.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>3.7.4</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-beanutils</groupId>
                    <artifactId>commons-beanutils</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jfree</groupId>
                    <artifactId>jcommon</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jfree</groupId>
                    <artifactId>jfreechart</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bcmail-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bcprov-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>bouncycastle</groupId>
                    <artifactId>bctsp-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>jdtcore</artifactId>
                    <groupId>eclipse</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
            <version>3.5.1</version>
        </dependency>
        <dependency>
            <groupId>ar.com.fdvs</groupId>
            <artifactId>DynamicJasper</artifactId>
            <version>3.1.2</version>
            <exclusions>
                <exclusion>
                    <groupId>jasperreports</groupId>
                    <artifactId>jasperreports</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.5</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.5</version>
        </dependency>
    </dependencies>
</project>

4.0.0
切贝
emc.front
3.1.3-快照
jboss
JBoss
http://repository.jboss.org/maven2/
弗里赫普
弗里赫普
http://java.freehep.org/maven2
JCurl
http://jcurl.berlios.de/m2/repo
爪哇网
http://download.java.net/maven/2/
djmaven2
http://www.fdvs.com.ar/djmaven2
DynamicJasper公共存储库
UTF-8
编译
src/main/java
src/test/java
目标/主要
目标/测试
ch/beo/emc/front/resources
src/main/resources
src/main/resources/security/jarsign
ch/beo/emc/front/resources
src/测试/资源
ch/beo/emc/front/resources
src/main/resources
src/main/resources/security/jarsign
org.apache.maven.plugins
maven编译器插件
1.6
1.6
org.codehaus.mojo
aspectj maven插件
1.1
1.6
org.springframework
春季方面
编译
测试编译
org.apache.maven.plugins
maven汇编插件
ch.beo.emc.front.factory.front
真的
解放党
assembly.xml
组装
包裹
单一的
org.apache.maven.plugins
maven surefire插件
ch/beo/emc/front/AllTests.java
org.apache.maven.plugins
maven阴影插件
1.4
包裹
阴凉处
假的
ch.beo.emc.front.factory.front
META-INF/spring.handlers
META-INF/spring.schemas
org.apache.maven.plugins
maven jar插件
签名
包裹
签名
src/main/resources/security/jarsign/server.pfx
pkcs12
beo-it.ch
****
${project.build.directory}/signed/${project.build.finalName}.jar
真的
com.l2fprod
l2fprod公共所有
6.9.1
org.swixml
swixml
1.5.144
net.java.balloottip
气球头
1.1
org.swinglabs
swingx
1.6
org.springframework
弹簧芯
2.5.6.SEC01
org.springframework
spring上下文
2.5.6.SEC01
org.springframework
春季aop
2.5.6.SEC01
org.springframework
<repository>
    <id>central</id>
    <url>http://repo.maven.apache.org/maven2/</url>
</repository>
<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>
<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>
<repositories>
    <repository>
        <id>central</id>
        <url>http://repo.maven.apache.org/maven2/</url>
    </repository>
</repositories>
[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]