Maven:范围值无效

时间:2014-01-13 10:23:58

标签: maven scope dependencies

找不到相关的文档:

使用“自定义”范围声明依赖项时会发生什么:

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

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

dependency:tree

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

...疯狂

1 个答案:

答案 0 :(得分:0)

Maven 3中的Pom验证得到了显着改善:这是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等扩展进行反向竞争的妥协。