Skip to content

nluksch/vodatime

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vodatime Add-On project

Note, this add-on has born as an example of "perfect Vaadin Add-On project setup". Its main purpose is to serva as a good example and improve overall build quality of various Vaadin Add-ons. This way I hope it eventually make contributions easier and more effortless on all Vaadin Add-ons. Still, the addon itself might already on its early steps be valid add-on for Vaadin Developers using Joda time.

The add-on itself currently only have two components

VodaDateField

A simple server side component that utilizes PropertyTranslator to provide support for JodaTimes DateTime type.

LocalDateBox

A supa simple component for LocalDate type. Also has own simple client side implementation based on GWT's DateBox.

Development

Project is built with Maven so it should be IDE agnostic and you should manage with basic maven skills without instructions. Basic steps during development are discussed below. Most actions can be easily accessed via IDE. Eclipse users should install m2e plugin.

I can already hear some of you asking "Why maven, I hate maven!?". All build systems have their weak parts and maven is not alone here. I have maven sometimes as well. Most often though maven is hated because developers are lazy and they don't want to understand the core concepts. If can dare you understand concepts of object oriented programming I could suggest you to at least try with Maven concepts. Here are some additional reasons:

  • Transient dependencies and massive library repository(ies)
  • It is not that hard
  • Maven is commonly used. Nowadays (at least among advanced java developers) more common than ant.
  • It drives towards "standars" so something learned on one project can be adapted on other
  • Wide IDE support -> extremely fast to start working on a project for real. If pom.xml properly set up a custom version can be started with "single click". TODO video tutorial

Check out sources

Sources for this project are located in github. Github has good instructions how to check out the source code to your computer.

https://github.com/mstahv/vodatime

Run full build

To packge and install addon-on jar to local repository you can assign following command:

mvn install

Optionally you might wish to do "clean build" by calling clean target before:

mvn clean install

During the install process tests are run automatically. As it requires GWT compiling test widgetset (if not up to date) and running Selenium tests it might take a while. If you wish to bypass tests run following command:

mvn install -DskipTests

Build Directory compatible zip package

The Vaadin Directory supports both jar and zip packaging. Zip packages have more features (like support for src and javadoc jar, supports adding e.g. required dependencies for non maven users and adding documentation in the zip package).

The zip package can be quilt using following command (also builds jar):

mvn install assembly:single

In this build following stuff is collected to the zip file:

  • add-on jar file
  • add-on sources jar file (most often enough for IDE users to get javadocs as well)
  • project dependecies with scope "compile" are collected to libs directory. For those poor souls who don't use a build system that supports transient dependencies this directory will help a lot when they start to use this add-on.
  • This readme file

The zip packagin can be customized by modifying assembly.xml file.

Running just tests

Tests written for this add-on are automatically executed during build but only running tests works with following command:

mvn test

To demonstrate how properly test you add-on the project has example of a simple unit test and a bit more advanced TestBench (or WebDriver) test to stress the whole chain from browser to server and back. TestBench is highly suggested (especially the soon to be released version 3), but one can so simple stuff with plain Selenium2 as well. The project has TestBench version commented out as its license might not fit for all developers if they have no Vaadin Pro Account subscription.

Unit tests can be written with tool of choice (maven supports most of them). JUnit is already configured.

Manually running test server and test apps during development

The TestServer class has a main method that you can launch. It opens an embedded jetty to port 9998. The main view lists all tests and clicking one opens it in a new window. The easiest method is usually running that from you IDE (e.g. open the class and then hit CTRL/CMD-F11 in Eclipse).

From command line one can launch it with easily with correct classpath with maven exec plugin:

mvn -e exec:java -Dexec.mainClass="org.vaadin.addon.vodatime.demoandtestapp.TestServer" -Dexec.classpathScope=test

Tests are loaded via reflection on each page load. Accessing http://localhost:9998/BasicTest will load a new instance of test class org.vaadin.addon.vodatime.demoandtestapp.BasicTest

GWT development

The client side code is developed with GWT. Just recompiling the widgetset happens with following command:

mvn gwt:compile

The development mode (aka hosted mode) is launched with target "gwt:debug" or "gwt:run". For the former you will attach a remote debugger. E.g. in e.g. Eclipse that is simple and m2e automatically sets the correct classpath.

About

Vaadin add-on supporting JodaTime as an example of perfect add-on build

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published