我有一个正在构建的战争模块,其中包括一些不应该包含的收缩包装罐。即:
WEB-INF/lib/shrinkwrap-api-1.0.0.jar
WEB-INF/lib/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar
WEB-INF/lib/shrinkwrap-descriptors-spi-2.0.0-alpha-2.jar
WEB-INF/lib/shrinkwrap-resolver-api-1.0.0-beta-6.jar
WEB-INF/lib/shrinkwrap-spi-1.0.0.jar
这些依赖项都在我们的 pom 中列为测试范围,因此它们不应该出现在我们的打包战争中。下面有更多信息,但我的问题是:为什么这些在这里。显然我缺少一些东西 - 它是什么/我在哪里可以找到它?
当我展示我的有效 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/xsd/maven-4.0.0.xsd">
...
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-extension-descriptors</artifactId>
<version>1.0.0-beta-6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-spi</artifactId>
<version>1.0.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-impl-base</artifactId>
<version>1.0.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api</artifactId>
<version>1.0.0-beta-6</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId>
<version>1.0.0-beta-6</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<version>1.0.0-beta-6</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-base</artifactId>
<version>2.0.0-alpha-2</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
<version>2.0.0-alpha-2</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-jboss</artifactId>
<version>2.0.0-alpha-2</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-gen</artifactId>
<version>2.0.0-alpha-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-impl-base</artifactId>
<version>2.0.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
<version>2.0.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-impl-jboss</artifactId>
<version>2.0.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-spi</artifactId>
<version>2.0.0-alpha-2</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId>
<version>1.0.0-beta-6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<version>1.0.0-beta-6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-impl-base</artifactId>
<version>1.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
...
</project>
当我打印依赖关系树时,我得到下面的输出(仅显示其中包含有问题的 jar 的节点。我确实看到其中一些 jar 被列为“运行时”和“运行时(从测试管理的范围)”但是我不确定这是否相关或它们如何被切换/包含为运行时,因为在大多数情况下,它们所属的依赖项是测试范围:
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ name_removed ---
...
[INFO] +- org.jboss.arquillian.extension:arquillian-seam2:jar:1.0.0.Alpha2:test
[INFO] | \- org.jboss.shrinkwrap:shrinkwrap-extension-descriptors:jar:1.0.0-beta-6:test (version managed from 1.0.0-beta-5)
[INFO] +- org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.0.0.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-spi:jar:1.0.0.Final:test
[INFO] | | +- org.jboss.arquillian.config:arquillian-config-api:jar:1.0.0.Final:test
[INFO] | | \- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.0.0.Final:test
[INFO] | +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.0.0.Final:test
[INFO] | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:2.0.0-alpha-2:runtime
[INFO] | \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-base:jar:2.0.0-alpha-2:runtime (version managed from 1.2.0-alpha-1)
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:jar:1.0.0-beta-6:test (scope not updated to runtime)
[INFO] +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:jar:1.0.0-beta-6:test (scope not updated to runtime)
[INFO] | +- org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:jar:1.0.0-beta-6:test
[INFO] | +- org.sonatype.aether:aether-api:jar:1.8:test
[INFO] | +- org.sonatype.aether:aether-util:jar:1.8:test
[INFO] | +- org.sonatype.aether:aether-connector-wagon:jar:1.8:test
[INFO] | | +- org.sonatype.aether:aether-spi:jar:1.8:test
[INFO] | | \- org.codehaus.plexus:plexus-container-default:jar:1.5.5:test
[INFO] | | +- org.codehaus.plexus:plexus-classworlds:jar:2.2.2:test
[INFO] | | +- org.apache.xbean:xbean-reflect:jar:3.4:test
[INFO] | | | \- commons-logging:commons-logging-api:jar:1.1:test
[INFO] | | \- com.google.collections:google-collections:jar:1.0:test
[INFO] | +- org.apache.maven:maven-aether-provider:jar:3.0.1:test
[INFO] | | +- org.apache.maven:maven-model:jar:3.0.1:test
[INFO] | | +- org.apache.maven:maven-model-builder:jar:3.0.1:test
[INFO] | | +- org.apache.maven:maven-repository-metadata:jar:3.0.1:test
[INFO] | | +- org.sonatype.aether:aether-impl:jar:1.8:test
[INFO] | | +- org.codehaus.plexus:plexus-component-annotations:jar:1.5.5:test
[INFO] | | \- org.codehaus.plexus:plexus-utils:jar:2.0.4:test
[INFO] | +- org.apache.maven:maven-settings-builder:jar:3.0.1:test
[INFO] | | +- org.codehaus.plexus:plexus-interpolation:jar:1.14:test
[INFO] | | +- org.apache.maven:maven-settings:jar:3.0.1:test
[INFO] | | \- org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:test
[INFO] | | \- org.sonatype.plexus:plexus-cipher:jar:1.4:test
[INFO] | +- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-7:test
[INFO] | +- org.apache.maven.wagon:wagon-file:jar:1.0-beta-7:test
[INFO] | \- org.apache.maven.wagon:wagon-http-lightweight:jar:1.0-beta-7:test
[INFO] | \- org.apache.maven.wagon:wagon-http-shared:jar:1.0-beta-7:test
[INFO] \- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.0.0:test (scope not updated to runtime)
[INFO] \- org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.0.0:runtime (scope managed from test)
[INFO] \- org.jboss.shrinkwrap:shrinkwrap-api:jar:1.0.0:runtime