среда, 17 июля 2013 г.

Apache Ivy. My experience.

I've been using Apache Ant for a long time. It is easy to use. But the most feature it lacks is a project dependency management. Moreover, I need not just resolve the open source projects, but to resolve my own projects.

In my development I have 2 projects that share common classes, which are in a third project. I also have a continues integration server. All projects are build on it and later deployed.

I found that Apache Ivy best suites my need. The reasons for this are:
  • it does integrate with Ant. 
  • it takes minimum intervention into the project to use Ivy. 
  • it has tutorials and good documentation. 

What I like is that in default configuration Ivy offers you a local repository. All you have to do is write an ivy.xml file, which describes your project and dependencies and modify build.xml.

In my situation I write the ivy.xml, that describes the shared project like this:
<ivy-module version="2.0">
    <info organisation="my" module="common"/>
    <publications>
      <artifact name="common" type="jar" />
    </publications>
</ivy-module>

And modified build.xml to publish project like this:
<!-- =================================
          target: publish-local
         ================================= -->
<target name="publish-local" depends="jar" description="--> publish this project in the local ivy repository">
        <tstamp>
            <format property="now" pattern="yyyyMMddHHmmss" />
        </tstamp>
        <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]" resolver="local" pubrevision="${version}" pubdate="${now}" forcedeliver="true" />
        <echo message="project ${ant.project.name} published locally with version ${version}" />
        <ivy:cleancache />
    </target>

In my other projects which depends on a "common.jar" I write the following ivy.xml:
<ivy-module version="2.0">
    <info organisation="my" module="booking"/>
    <dependencies>
        <dependency name="common" rev="latest.integration" />
    </dependencies>
</ivy-module>

And modified the build.xml like this:
<!-- =================================
          target: resolve             
         ================================= -->
    <target name="resolve" depends="clean, clean-cache">
        <ivy:retrieve />
    </target>

That is all.

One more thing. You can use Ivy in Eclipse. For this one can download plugin IvyDE.

среда, 3 июля 2013 г.

Book review. Java EE 6 Cookbook for Securing, Tuning, and Extending Enterprise Applications

Hi. Have just finished reading "Java EE 6 Cookbook for Securing, Tuning, and Extending Enterprise Applications".

A good book to scratch the surface from the J2EE development. It gives you an overview of J2EE 6 and gives you direction to further investigation. The cons of this book are a tutorial style which describes how to do something in different containers. In my opinion this information can be obtained from the documentation to that containers.