refactored dependency related tasks into more OO manner and
use better integration of java and ruby.

this also avoids opening many streams (to files) instead it
needs only one stream at a time.
Merge pull request #764 from mkristian/merge-dependency-one-file-after-the-other

refactored dependency related tasks into more OO manner and