Dependency, war, and vaadin questions


(Supagoat) #1

I’m having some trouble getting gradle to do exactly what I want and I’d love some help… I’m trying to build a multi-project java project. The UI layer uses vaadin, so I added:

apply from: ‘http://plugins.jasoft.fi/vaadin.plugin

to that project’s build.gradle. I’m also following the pattern of chapter 7 and putting hte apply plugin:java in a subprojects {} in the top level build file.

This leaves me with 2 problems:

  1. The first time (after clean) I run gradle build, the vaadin project fails because it can’t find the vaadin libraries, but re-running gradle build works. 2) The vaadin plugin seems to build a war file automatically but for some reason doesn’t include its static resources in the jar.

Second problem: Where do dependent jars get put after the build? For example, in another subproject (that the vaadin project depends on) I have:

dependencies {

compile ‘net.sf.opencsv:opencsv:2.3’ }

And it does compile even on its own, but when I make a jar of it the opencsv file is nowhere to be found. However both the project jar and opencsv jar are included in the war file generated by the vaadin plugin, so that’s good.

I suspect there’s probably a way to tell the vaadin project what extra stuff to include in the war file… How do I do that?

And if I were working on a project that doesn’t produce a war, where do I find the dependent jars?

Oh also, what’s the correct way to indicate multiple dependencies on a task? When the manual uses the task X(dependsOn: ‘:y:z’) format it only ever shows an example with 1. How would I add another? Do I just use dependencies { } instead? What’s the difference?

Thanks. That should get me started, I think.


(Supagoat) #2

After struggling with gradle yesterday I started again from scratch today and I finally got it. My mental model from yesterday’s work was flawed.

Oh, and I finally found a part in the documentation where there are multiple dependsOn. For those who don’t know and might stumble on this, you pass an array. (dependsOn: [’:ab’, ‘:cd’])

I also dumped the vaadin plugin since I don’t actually want anything it does (I create my vaadin projects with the eclipse plugin). Now I assemble my war file in my build script.