I have a gradle build file. It uses the Java plugin and does not specify a version number for the jars being produced. As a result all my jars get produced as X-unspecified-jar, where X is my project name.
How do I get rid of the “-unspecified” part? I don’t want to manage versioning in my build file, I do it externally.
Nevertheless I recommend to set ‘project.version’, as Gradle uses this information in many places. You can set it to an external value (e.g. environment variable or system property).
Not for me. Actually, unless you set ‘project.version’, you shouldn’t have to do anything to get ‘X.jar’. Which Gradle version? Can you share a self-contained build script that allows to reproduce the problem?
Gradle build time: Monday, January 28, 2013 3:42:46 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_21 (Oracle Corporation 23.21-b01) OS: Mac OS X 10.7.5 x86_64
A self contained build file is a bit hard to come up with here – it’s a large build. The part of my build file that configures my java plugin is as follows
Works fine for me with 1.4 as well. Chances are that something in your build scripts (or third-party plugins) is causing this. You can try to override the whole archive name:
Doesn’t necessarily have to be version number. If overwriting ‘archiveName’ doesn’t work either, your best chance is to shrink the build until you’ve found the cause. Also make sure you don’t have anything in ‘~/.gradle/init.gradle’ and aren’t using a custom Gradle distribution.
‘.gradle/’ in the root project dir and ‘~/.gradle/caches/’. (You might want to keep the “artifacts-xy” dirs, or external dependencies will be downloaded again.) You can verify Gradle’s default behavior with a build whose ‘build.gradle’ just contains ‘apply plugin: “java”’ (no need for source dirs etc.). Then run ‘gradle build’ and look into ‘builds/lib’.