Maven属性标记和依赖的版本

时间:2016-06-20 02:32:12

标签: maven-3 cucumber-junit cucumber-java

当我使用pom文件的属性部分中定义的键的依赖项的版本时,不会下载依赖项,但是当我为依赖项编译硬件时,依赖项将被下载。

    <select ng-init="uListModel=users[0]" 
ng-options='x as (x.fName+" "+x.lName) for x in users' ng-model="uListModel"></select>

对于上面的块,当我运行 mvn clean test 时,然后在控制台中错误显示为: -

<properties>
    <cucumber-version>1.2.4</cucumber-version>
    <junit-version>1.2.4</junit-version>
</properties>

<dependencies>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>{cucumber-version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>{cucumber-version}</version>
        <scope>test</scope>
    </dependency>
 <dependencies>

完成pom.xml

[ERROR] Failed to execute goal on project MavenCucumber: Could not resolve dependencies for project com.manish.cucumber:MavenCucumber:jar:1.0-SNAPSHOT: Failed to collect dependencies at info.cukes:cucumber-java:jar:{junit-version}: Failed to read artifact descriptor for info.cukes:cucumber-java:jar:{junit-version}: Could not transfer artifact info.cukes:cucumber-java:pom:{junit-version} from/to central (http://repo.maven.apache.org/maven2): Illegal character in path at index 61: http://repo.maven.apache.org/maven2/info/cukes/cucumber-java/{cucumber-version}/cucumber-java-{cucumber-version}.pom -> [Help 1]

xsi:schemaLocation =&#34; http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&#34;&gt;     4.0.0     com.manish.cucumber     MavenCucumber     罐     1.0-SNAPSHOT     MavenCucmber     http://maven.apache.org

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

我使用的Maven版本是Maven-3

为什么maven尝试从url获取依赖,如下所示: -

repo.maven.apache.org/maven2/info/cukes/cucumber-java/ {黄瓜版本} /黄瓜-Java的{黄瓜版本} .pom

为什么不将{cucumber-version}替换为属性标签

中定义的1.2.4

1 个答案:

答案 0 :(得分:1)

看起来你的语法不正确。它应该以$ symbol为前缀。

放入$ {junit-version}而不是{junit-version}