Greetings Hilco, On Wed, Jan 19, 2011 at 8:07 PM, Hilco Wijbenga <hilco.wijbe...@gmail.com> wrote: > > Option 1: It's easy to write a POM that creates a JAR for a GWT widget > including CSS and other resources. It's also easy to then write a POM > that depends on that JAR and creates a WAR for integration testing. So > far so good.
This is by far the best solution. If you want to create widgets to be shared across multiple projects, just make a packaging=jar and make sure src/main/java is part of build.resources. Then include src/main/java/com/acme/gwt/client/MyWidget.java and src/main/resources/com/acme/gwt/MyWidgets.gwt.xml as part of the project and install it as per usual (mvn install). > Problem: Making changes in (e.g.) the CSS requires a full rebuild of > both the JAR and the WAR. This is a real productivity issue. I'm not unsympathetic to this, but you can't have it both ways. You either want re-usable components a la a library, which has a bit of steadiness to it, or you want rapid development -- they are competing goals. > Option 2: Put everything in a single WAR project. Integration testing > uses this WAR and development can make changes that are reflected > after a simple refresh. Yep, you can definitely do this, but it goes against the (unstated by OP) goal of reusability of components. > Problem: We need a JAR, not a WAR for our other GWT projects that want > to reuse the widget. Your war project which wants to incorporate the reusable widget jar need only to add <inherits name="com.acme.gwt.MyWidgets"/> and then utilize MyWidget somewhere. It will be properly compiled, and since you include src/main/java as part of the reusable widget's build.resources, GWT compiler will be happy. > The only "solution" that I can see is to go with option 2 and create a > second (JAR) project that depends on the WAR and strips away all its > "web-app-ness" to create the JAR I referred to in option 1. This > achieves all my goals but isn't very elegant. Can anyone think of a > better way to do this? Best of luck to you, I have had a lot of success with the method I've outlined. I have about two dozen general purpose widgets, twice that in general reusable GWT async services, and incorporated them into about 20 internal projects. Everything works quite nicely... -Jesse -- There are 10 types of people in this world, those that can read binary and those that can not. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org