I am having a real problem with my Gradle build and was hoping someone could lend a 2nd set of eyes. Here's my 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")
}
Here's my 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>
When I run gradle install
, Gradle 'installs' this JAR/POM under:
~/.m2/repository/com/myorg/mylib/unspecified/
mylib-unspecified.jar
mylib-unspecified.pom
Whereas, I would have expected:
~/.m2/repository/com/myorg/mylib/6.0/
mylib-6.0.jar
mylib-6.0.pom
What is this 'unspecified
' business, and where am I going awry?
Apparently the version in the pom is not used in the install task. Try to specify the version on project level next to the group like this:
group = 'myorg'
version = '6.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With