Howto force artifacts with empty version number with -D or -P arguments?


(Jaume Teixi) #1

I try to generate .war files without version numbers. Can one use a command line arguments to force empty version number? something like: gradle -Dorg.gradle.project.version=null build gradle -Pproject.version=null build


(uklance) #2

Are you just trying to change the filename of the war?

If so, you could configure the war plugin

apply plugin: 'war'
war {
   archiveName = "${project.name}.war"
}

(Jaume Teixi) #3

Well the idea is can if can we override the build.gradle settings via arguments (when building via Jenkins)?


(uklance) #4
war {
   if (System.properties.containsKey("archiveName")) {
      archiveName = System.getProperty("archiveName")
   }
}

gradle -ParchiveName=foo.war build


(Jaume Teixi) #5

What is working with gradle 1.12:

if ( project.hasProperty("foo") && ("bar"==project.getProperty("foo")) ) {
        }
gradle -Pfoo=bar build