gpt4 book ai didi

Maven 似乎正在拉入具有测试范围的 jar

转载 作者:行者123 更新时间:2023-12-02 15:14:54 24 4
gpt4 key购买 nike

我有一个正在构建的 war 模块,其中包含一些不应该包含的收缩包装 jar 。即:

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

这些依赖项都在我们的 poms 中列为测试范围,因此它们不应该出现在我们的打包 war 中。更多信息如下,但我的问题是:为什么这些在这里。显然我遗漏了一些东西 - 它是什么/我在哪里可以找到它?

当我展示有效的 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

最佳答案

看起来这是 Arquillian 使用的 BOM 的问题:

https://issues.jboss.org/browse/ARQ-889

我们已经更新到修复版本,一切正常。

关于Maven 似乎正在拉入具有测试范围的 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11103092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com