Several fixes concerning the Maven config plus GWT plugin - #2
6 commits merged into
Conversation
|
I have no problem adding testatoo as a test scope dependency but I would prefer keep jetty as an explicit compile scope dependency. What's puzzling is that WebSocketTransport.java will not compile with any version of jetty newer than 7.1.6 (due to changes in the WebSocket interface). Yet it compiles with testatoo-container-jetty which depends on jetty 8.0.0.M2. Also, the jetty-maven-plugin lets me run the samples from the command line. Regarding the GWT sample, Inplace isn't necessary, I can just run jetty:run-exploded (which only needs mvn package, no clean install). |
|
Hi, Jetty must not be put as a compile scope dependency. This is a typical dependency scope error that you might do when you start using Maven. The reason is that Maven manages transitive dependencies for you. When you develop in a library with Maven, you have to think about how the project will be used and which library my project must really depend on to work. If you put jetty as a compile dependency, it means an end-project depending on Socket.IO-Java will transitively get the jetty jars, and they will also get into the war file. This will create conflicts. With Maven, scopes are really important:
In the case of your project, the core relies on jetty. So the scope must be optional or provided, since you deploy on jetty containers. The good scope would be provided. For GWT sample, yes it's true that you can run the app using jetty:run-exploded. It also would be the case if you use the maven plugin to execute the class Start*. The reason why an embedded containers is better to use is:
I'm an expert in Maven (+5 years) and in unit and ui testing so the commits I propose do not come from nowhere. We have a huge experience in working in maven project (libraries and webapp) and how to unit test them correctly in an automated environnment (i.e. Hudson). So I hope you'll understand the implications of all of this. Please also note that we are pleased to contribute to this project (this is just a beginning), but if we always end up with discussions like this to prove our points to improve the project, it takes a lot of time and it will be much easier for use to make a distinct clone with a distinct name internally at Ovea and merge into our new open-source project the new features of Socket.IO-Java when they appear. For your information, Socket.IO-Java runs each time a commit is done in our CI environnement. We are currently in a big project for mobiles and we plan to make these future contributions:
|
|
Sorry for using mixed nomenclature. I'm aware of the difference between "provided" and "compile" scope dependencies. What I should have said that I prefer explicitly identifying the version of jetty needed to compile and run the modules. If I specify version 7.1.6 of jetty WebSocketTransport.java compiles. If I specify version 8.0.0.M2, it fails to compile due to the changes made to the WebSocket interface in version 7.2.0 of Jetty. But, If I remove the jetty dependencies and instead use the testatoo-container-jetty dependency, it compiles even though testatoo-container-jetty depends on jetty 8.0.0.M2. Why is that? When I run "mvn dependency:tree" it displays: So how is it that WebSocketTransport.java compiles when the jetty 8.0.0.M2 WebSocket interface includes onFragment, yet WebSocketTransport doesn't override it and should't compile? Given the MIT license I realize that you don't have to work with me at all so I appreciate that you are in fact trying to work with me. I've spent a lot of time over the last few days reading about maven and I'd appreciate if if you bear with me as I become familier with it. |
|
Hi, Yes they added a new method on the interface: So if you see in our fork, we've implemented it like this in WebSocketTransport.java (http://tinyurl.com/5u7j7ln): This way, it will compile and run on jetty 8 and also work on jetty 7. Annotations are metadata not used at runtime so the implemented method will just not be used in jetty 7. I did not check deeply yet on the implementation detail, i.e. if some implementation is required or not, if this method is used or not in the case of Socket.IO for jetty 8. But we are using Jetty 8 + Socket.IO and it works well. |
|
Ah, I hadn't noticed that change to WebSocketTransport in your patch. I'll work on merging this pull request tomorrow. Regarding the chat-gwt sample, do you have any objections to using the exploded war dir instead of placing the compiled GWT in the webapp dir? I like to avoid mixing output with source when I can. |
|
Hi, |
Do not forget to issue a 'mvn license:check' from the root of the multi-module project
Regarding Testatoo: testatoo is an open source project to simplify the startup of webapps on different containers from your project. Instead of depending on all jetty jars, and having issues on war exclusions, and also instead of waiting for jetty:run to start, simply use testatoo instead.
I've done in each sample project a main class: Start_. Thus, from your IDE, simply run Start_ from any sample you want to start (do not forget, as any launcher, the basedir must be the module dir). It will launch an embedded container directly from your IDE. This is faster and easier to debug !
Note 1: you had to remove testatoo snapshot since it was not yet in the Maven repository. But last week we deployed it so it's ok to use it now.
Note 2: before launching the GWT webapp, you have to execute:
mvn clean install
This will run the license check plus the GWT compilation in place so that gwt-generated files are put directly in src/main/webapp. This is usefull to be able to run the webapp directly from the IDE.
Note 3: I've fixes somes issues preventing a potential Maven release: when maven releases, it first execute mvn verify to check for local modification and licenses. Licenses and local modifications were existing.
After all of this, the structure is now stable and releasable. So it means both you and us are able to deploy in our own repositories. Also, the integration of a tool like testatoo is a great addition because we plan to contribute in unit testing and automatic browser testing. So we need to be able to start webapps directly from the project (junit tests).
Thanks,
Mathieu.