为什么'gradle install'用'未指定'替换我的版本?

sme*_*eeb 4 java gradle pom.xml maven

我的Gradle构建存在一个真正的问题,希望有人可以借出第二眼.这是我的build.grade:

apply plugin: 'groovy'
apply plugin: 'maven'

group = 'myorg'

task createPom << {
    pom {
        project {
            groupId 'myorg'
            artifactId 'mylib'
            version '6.0'

            inceptionYear '2015'
            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                }
            }
        }
    }.writeTo("pom.xml")
}
Run Code Online (Sandbox Code Playgroud)

这是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <groupId>myorg</groupId>
    <artifactId>mylib</artifactId>
    <version>6.0</version>

    <inceptionYear>2015</inceptionYear>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
</project>
Run Code Online (Sandbox Code Playgroud)

当我运行时gradle install,Gradle'安装'此JAR/POM:

~/.m2/repository/com/myorg/mylib/unspecified/
    mylib-unspecified.jar
    mylib-unspecified.pom
Run Code Online (Sandbox Code Playgroud)

然而,我原以为:

~/.m2/repository/com/myorg/mylib/6.0/
    mylib-6.0.jar
    mylib-6.0.pom
Run Code Online (Sandbox Code Playgroud)

这是什么unspecified业务,我在哪里出错?

Hen*_*nry 7

显然,pom中的版本未在安装任务中使用.尝试在组旁边的项目级别指定版本,如下所示:

group = 'myorg'
version = '6.0'
Run Code Online (Sandbox Code Playgroud)