Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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
Java 使用Arquillian Shrinkwrap解析器Maven从pom.xml读取依赖项_Java_Maven_Jboss Arquillian_Shrinkwrap_Dependency Resolver - Fatal编程技术网

Java 使用Arquillian Shrinkwrap解析器Maven从pom.xml读取依赖项

Java 使用Arquillian Shrinkwrap解析器Maven从pom.xml读取依赖项,java,maven,jboss-arquillian,shrinkwrap,dependency-resolver,Java,Maven,Jboss Arquillian,Shrinkwrap,Dependency Resolver,我正在尝试使用包覆面提取依赖项解析器将库添加到包覆面提取存档中,以便将其部署到服务器上进行Arquillian测试 我正在使用以下pom.xml: <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

我正在尝试使用包覆面提取依赖项解析器将库添加到包覆面提取存档中,以便将其部署到服务器上进行Arquillian测试

我正在使用以下pom.xml:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>xxx</groupId>
  <artifactId>ArqTest</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.junit>4.11</version.junit>
    <version.arquillian>1.1.1.Final</version.arquillian>
    <version.wildfly.as>8.0.0.Beta1</version.wildfly.as>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.itextpdf</groupId>
      <artifactId>itextpdf</artifactId>
      <version>5.4.4</version>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-spi</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-api-maven</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-spi-maven</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.protocol</groupId>
      <artifactId>arquillian-protocol-servlet</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-version</artifactId>
        <version>${version.wildfly.as}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-bom</artifactId>
        <version>2.0.0</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${version.junit}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>${version.arquillian}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>${version.arquillian}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <finalName>arquillian-tutorial</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jbossas-managed-wildfly-8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <testFailureIgnore>true</testFailureIgnore>
              <systemPropertyVariables>
                <arquillian.launch>jbossas-managed-wildfly-8</arquillian.launch>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-spec-api</artifactId>
          <version>8.0.0.Beta1</version>
          <type>pom</type>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-arquillian-container-managed</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-arquillian-protocol-jmx</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-arquillian-common</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
如果我不解决itextpdf依赖关系,它会给我一个NoDefClass-found错误,到目前为止还可以。因此,它希望从pom的依赖项项添加库。从pom获取它很重要,因为测试在不同的机器上运行

使用包覆面提取解析程序2.0.0时出现的错误如下:

java.lang.ClassCastException: Cannot cast org.apache.maven.repository.internal.DefaultVersionResolver to org.sonatype.aether.impl.VersionResolver
    at java.lang.Class.cast(Class.java:3094)
[...]
java.lang.IllegalArgumentException: version resolver has not been specified
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.setVersionResolver(DefaultRepositorySystem.java:164)
[...]
在捕获所有异常时,还会抛出以下内容:

RuntimeException: Could not create object from user view
我能够在以下位置找到此问题的来源:


到目前为止,我不知道为什么会出现这个错误,因为谷歌找到的所有来源都告诉我,系统正在运行。有什么想法吗?

看起来这个问题是因为WildFly POM指定了maven Ether provider的更新版本。在
3.1.0
(来自WildFly)中,它依赖于
org.eclipse.ether:ether-[api | impl | spi]
,其中
3.0.5
(来自包覆膜解析程序)使用
org.sonatype.ether:ether-[api | impl | spi]
。如果您查看已解析的依赖项,您的类路径中将同时包含这两个依赖项,这将导致
ClassCastException
。添加以下依赖项可以解决此问题:

 <dependency>
   <groupId>org.apache.maven</groupId>
   <artifactId>maven-aether-provider</artifactId>
   <version>3.0.5</version>
   <scope>test</scope>
 </dependency>

org.apache.maven
maven乙醚提供商
3.0.5
测试

这个问题似乎是因为WildFly POM指定了maven Ether提供程序的更新版本。在
3.1.0
(来自WildFly)中,它依赖于
org.eclipse.ether:ether-[api | impl | spi]
,其中
3.0.5
(来自包覆膜解析程序)使用
org.sonatype.ether:ether-[api | impl | spi]
。如果您查看已解析的依赖项,您的类路径中将同时包含这两个依赖项,这将导致
ClassCastException
。添加以下依赖项可以解决此问题:

 <dependency>
   <groupId>org.apache.maven</groupId>
   <artifactId>maven-aether-provider</artifactId>
   <version>3.0.5</version>
   <scope>test</scope>
 </dependency>

org.apache.maven
maven乙醚提供商
3.0.5
测试