Mulitple jars for single project

(m m) #1

I need to build two jars from the same project. One of the jars will have nomral class files and the second one will have the class files modified by jibx binding . Is it possible to achive this ? Please share if you have any ideas.

(Tomas Lycken) #2

You could just create a second task that does this, and inherit from the Jar type:

task otherJar(type: Jar, dependsOn: jar) {

// specify what do do with the second archive


(m m) #3

Thanks for the reply. The other jar has to be build , with additional task ( recompile the source and include jibx binding ), which needs to create another jar in a different name . Since the name of project can be controlled only in settings.gradle , from this method would it be possible to create another jar with different name ?

(Tomas Lycken) #4

I don’t know if you found a solution to your problem, but you can change the name of the archive by changing one or more of the properties ‘baseName’, ‘appendix’, ‘version’ and ‘classifier’, to get a name on the form ‘baseName-appendix-version-classifier.ext’ where ‘ext’ will be “jar”, “zip”, “tbz2” etc depending on the type of archiving task. You could also just change the ‘archiveName’ property, and set the name (without extension) to whatever you want.

More info is available in the documentation.

Sorry for the delay - hope this is helpful anyway =)

(m m) #5

Thanks for the reply.

This is how I solved try problem.

I created two project project-without-binding and project-with-binding

The project without binding had all the source code and was a normal jar. Project with binding did not have any source code. But the sourceset property of the project is set to the other project ( both projects are multi project with one settings.gradle ) .This project will do the compilation + binding and create the jar in different name.