Now for the jar task:

Thanks to Hans I found two ways to do it, one of them is:



    dists {
        jar(appendix: 'client') {
            dependsOn 'clientCompile'
            fileSet(dir: new File(buildDir, 'client-classes'))
        }
    }


Disadvantages, however, are:


there seems to be a hidden dependency to war (I'm using the War-Plugin), so
compile, test and war tasks are performed, even if I just wanted to rebuild
the client jar (gradle archive_client_jar)
I can't set a custom jar name like myClient-<version>.jar, it will
always be <archiveBaseName>-<appendix>-<version>.jar
the task is based on the jar name - as I have multiple projects, I always
want to have the same call, e.g. "gradle client" independent of the actual
name of the client jar


Thus, I think the following is the better way:


    createTask('client', type: Jar, dependsOn: clientCompile).configure {
        baseName = 'someWeirdNameForMyClientJar'
        fileSet(dir: new File(buildDir, 'client-classes')) {}
        conventionMapping(DefaultConventionsToPropertiesMapping.JAR)
    }


And again it would be nice, if the tasks like jar or compile had the
convention mapping by default.
A lot in gradle is based on convention, so using the convention object as
convention should be the preferred way ;-)

-- 
View this message in context: 
http://www.nabble.com/Additional-dependency-configuration-and-additional-compile-task-tp19991304p20091752.html
Sent from the gradle-user mailing list archive at Nabble.com.

Reply via email to