为什么 'gradle install' 将我的版本替换为 'unspecified'?
Why is 'gradle install' replacing my version with 'unspecified'?
我的 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")
}
这是我的 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>
当我运行gradle install
,Gradle'installs'这个JAR/POM下:
~/.m2/repository/com/myorg/mylib/unspecified/
mylib-unspecified.jar
mylib-unspecified.pom
然而,我本以为:
~/.m2/repository/com/myorg/mylib/6.0/
mylib-6.0.jar
mylib-6.0.pom
这是什么“unspecified
”业务,我哪里出错了?
显然安装任务中没有使用 pom 中的版本。尝试在组旁边的项目级别指定版本,如下所示:
group = 'myorg'
version = '6.0'
我的 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")
}
这是我的 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>
当我运行gradle install
,Gradle'installs'这个JAR/POM下:
~/.m2/repository/com/myorg/mylib/unspecified/
mylib-unspecified.jar
mylib-unspecified.pom
然而,我本以为:
~/.m2/repository/com/myorg/mylib/6.0/
mylib-6.0.jar
mylib-6.0.pom
这是什么“unspecified
”业务,我哪里出错了?
显然安装任务中没有使用 pom 中的版本。尝试在组旁边的项目级别指定版本,如下所示:
group = 'myorg'
version = '6.0'