【问题标题】:Maven : invalid scope valueMaven:无效的范围值
【发布时间】:2014-01-13 10:23:57
【问题描述】:

找不到相关文档:

当您声明具有“自定义”范围的依赖项时会发生什么:

    <dependency>
        <groupId>group</groupId>
        <artifactId>artifact</artifactId>
        <version>1.0</version>
        <scope>whatever</scope>
    </dependency>

没有检查,这个没有失败:

dependency:tree

[INFO] +- group:artifact:jar:1.0:whatever

疯了……

【问题讨论】:

  • 你使用哪个 maven 版本?如果我尝试使用 Maven 3.0.5,我会收到警告。

标签: maven scope dependencies


【解决方案1】:

Pom 验证在 Maven 3 中得到显着改进:这是一个警告,因为 MNG-3991

[WARNING] 'dependencies.dependency.scope' for junit:junit:jar must be one of [provided, compile, runtime, test, system] but is 'xxxx'. @ line 27, column 11
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

正如问题所指出的,即使在 Maven 3 中,它仍然只是一个警告,而不是失败:

这是一种折衷方案,可与使用自定义依赖范围的扩展(如 Flex Mojos)保持向后兼容。

【讨论】:

  • 好的,但是在 maven 2 中,哪个类路径中有这样的依赖关系?
  • 在 Maven 2 中,未知范围为 treated like compile
猜你喜欢
  • 2021-12-31
  • 1970-01-01
  • 2019-12-01
  • 2020-10-07
  • 2019-07-25
  • 2020-02-16
  • 2020-11-01
  • 2020-12-02
  • 2020-12-28
相关资源
最近更新 更多