Recently I started doing some really serious Talend Open Studio component development for my company and for a spinoff of mine, so I realized that using a more robust build life-cycle would be great to speed-up development and avoid doing repetitive tasks (developing TOS component is really tedious and boring for such causes, actually). Since Talend team doesn’t seem to agree with this vision and the only other solution apparently made doesn’t satisfy my needs, I opted for a do-it-yourself approach and adopted Maven in Talend development for all my self-made components.

The idea is basically to provide a skeleton hello-world component supplied with a pom.xml files with a bunch of goals useful in component package and install. As a very quick start, you just need to check it out from my github repository, clone it and start playing following provided README information. It should be really easy to make it up-and-running in minutes if you follow this simple tutorial.

Benefits of using Maven in Talend

The benefits of using Maven are many, as Apache Software Foundations says, and all applies to TOS component development, too.

First of all, you can easily integrate tests in your build cycle. Too often, TOS developers simply doesn’t test their  components an Talend guidelines on the subject are incomplete and not mainly focused on custom components. But a java-level test suite is mandatory for every serious development and should be planned with care.

Then, you can decouple your TOS custom component folder from your development environment. It’s trivial to say that  it’s always a good idea to have dev and prod environments as isolated as possible and to let maven handle the release process. This skeleton component, for example, let you specify a target deploy directory (the TOS custom component folder, usually) where the component will be copied when a maven install trigger is issued.

And finally (and that’s nice, don’t you think so?) Maven can help you automatically maintain external dependencies and patch you component XML file accordingly. The idea is: you declare your needed dependencies in pom.xml file, as any regular java application and during the package phase the <IMPORTS> element in XML is automatically updated. No need to update it manually.

Since i remember well how painful is to copy paste all these external libraries in XML, and keeping the version number up-to-date and so on, I decided it’s a nice feature to have.

Relevant build phases and parameters

The build life-cycle is quite simple as just few phases have sense in TOS component deployment:

  • package – when the internal component extra-jar (if present) and the external dependencies are assembled and all needed resources (javajet files, icon, messages…) are compiled and assembled in the target basedir directory and when XML file is patched to match your dependency tree and some metadata are updated (author name, build timestamp and so on). It basically makes all the necessary steps to build the component but doesn’t copy it in the target folder;
  • install – when the packaged component is copied in a specified folder that it’s assumed to be the TOS custom component folder;
  • clean – when target dir is cleaned-up.
Please not that for several reason, a TOS component is not a regular java artifact. That’s why I disabled the default-install process (which by default install the artifact in the local maven repository). The provided install phase simply copy the component to the target folder.
You can also specify a bunch of optional command-line properties, to tune-up the build process depending on your needs and your environment:
  • skipTests (default: true) to skip/unskip the test phase
  • component-author (default: Gabriele Baldassarre…ehm…It’s me) to set the component author in XML descriptor;
  • addMavenDescription (default: true) to add/cut the META-INF/maven stuff in client JAR;
  • dependencyVersion (default: true) to add/cut the version number suffix to all external dependencies;
  • useSnapshot (default: true) to use or not snapshot releases in all external dependencies;
  • componentsFolder (default: $HOME$/talend_components) path to your installation TOS custom component folder, used during the install phase.

Get the plugin

The skeleton plugin (that just prints out a HelloWorld string out to the console) is available on github. Feel free to clone and fork it as you wish and just comment this post or contact me if you need further support.

Share This