I’m getting more and more into the Java World at the moment. Switching from pure Domino to pure Java. Outside of Domino, there’s a lot about manageing dependencies. The freedom of choice is paid by work to beat different runtimes.
Looking for a decent tool to help managing dependencies I came across Ant, Maven and Gradle.
Ant I new from the past. It’s ok but seems to be a lot of code to write and it’s XML…
Maven? Seems that I’m not smart enough.
I was not able to setup a working multi project setup without installing my sub projects in a repository. And it’s XML too.
Gradle, the youngest among these three, groovy based. After reading through some tutorials, and combing through stackoverflow I was able to setup my multi-project build,
with integratopm into my eclipse environment.
Even a Vaadin client is compiling with the right plugin. So I was not forced to use the Vaadin eclipse plugin at all. One thing I was not happy, the Vaadin plugin compiles some JavaDoc and Sources into my final EAR.
Step 1: Remove the JavaDoc and Sources from the deployment descriptor
deploymentDescriptor{ .... withXml { def javaDocNode = asNode().module.find { it.ejb.text().contains('javadoc.jar') } if (javaDocNode) { asNode().remove( javaDocNode ) } def sourceNode = asNode().module.find{it.ejb.text().contains('sources.jar') } if (sourceNode) { asNode().remove(sourceNode) } } }
Step 2: Removing the actual Jar’s from the EAR
This page helped me creating the following block
import org.apache.tools.ant.taskdefs.condition.Os task removeJars (dependsOn:'ear'){ description 'Entferne unnötige Source und JavaDoc Jars' doLast { if (Os.isFamily(Os.FAMILY_UNIX)){ println "Entferne unnötige Source und JavaDoc Jars" exec { executable "zip" args "-d", "build/libs/${project.archivesBaseName}-${project.version}.ear", "*-${project.version}-sources.jar" } exec { executable "zip" args "-d", "build/libs/${project.archivesBaseName}-${project.version}.ear", "*-${project.version}-javadoc.jar" } } else { println "get Linux!" } } }
Now I can build my EAR by simply calling gradle assemble removeJars