Thursday 28 February 2013

Ant tasks with Eclipse

When managing an eclipse project and building it with ANT it can be a real pain to constantly manage the class paths in the ANT file and your project. The EBuilder ant tasks make this easier.

There is a project on source forge (http://ebuild.firefang.net/) which does this nicely however there are a couple of flaws in that version and I have created a new release (Sourceforge version TBA post a request to me and I will send it to you).

After downloading and placing the JAR into your ANT_HOME\lib directory, the way the project works is the typical task definition:

<taskdef       resource="firefang_ant.properties"      classpathref="ant.lib.classpath" />

... followed by a series of tasks the most useful of which is the eclipse_cp  task.
This will read a specified .classpath file from your project and scan the entries it finds there.
ie.

<eclipse_cp action="libs" rootdir="${project.dir}" project="." result="proj.libs" />

See Eclipse Help

Your .classpath will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="test"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="conf"/>
    <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=*"/>
    <classpathentry kind="output" path="build"/>
</classpath>

The action attribute on the task can be any of the following values:
lib : Which reads the library entries;
src: Which reads the source entries;
output : Which reads the library entries;

This produces a ';' separated list which can be used directly as a class path or it can have the libaries turned into fully qualified paths (the next iteration of the project).

ie.

<for list="${proj.libs}" param="lib" delimiter=";">
                    <sequential>
                        <echo message="    checking @{lib}"/>
                        <!--
                        <var name="build.classpath" value="${build.classpath};${project.dir}/@{lib}" />
                        -->
                        <if>
                            <available file="@{lib}"/>
                            <then>
                                <var name="build.classpath" value="${build.classpath};@{lib}" />
                            </then>
                            <else>
                                <var name="build.classpath" value="${build.classpath};${project.dir}/@{lib}" />
                            </else>
                        </if>
                       
                    </sequential>
                </for>


NB. The above uses ant-contrib v1 (http://ant-contrib.sourceforge.net/)






Setting up Eclipse check list (Part 3) - Plugins Extras

Previously in this series

Following on from the previous blog of a year ago I found my self setting up Juno and I thought it might be an idea to update the list of plugins I use.
So this is the set I find most useful:

SubEclipse

Links to subversion.
Juno comes with the GIT integration but for a few ludites this is still nice.
The update site is http://subclipse.tigris.org/update_1.8.x 


StartExplorer Eclipse Plug-in

This plug-in offers tight integration of system file manager (Windows Explorer, Gnome Nautilus, KDE Konqueror, Mac Finder, ...) and shell (cmd.exe, Linux/Mac terminal) in Eclipse.
The update site is http://basti1302.github.com/startexplorer/update/

Log4E

Log4E is an Eclipse Plugin which helps you to use your logger easily in Java Projects.
The Plugin Log4E is not bound to any special logging framework. Thus you might be able to adapt to your own logger by defining your own templates using the preferences. It has active support for Log4j, SLF4J, Commons Logging and JDK 1.4 logging.

Aptana

Aptana Studio 3.2.2 is a complete environment that includes extensive capabilities to build Ruby and Rails, PHP, and Python applications, along with complete HTML, CSS and JavaScript editing.

Or preferably by adding the following update site http://download.aptana.com/studio3/plugin/install

Monday 4 February 2013

Cute tool of the day - Lorum Ipsum

“Lorem ipsum” dummy text is used by many web-developers to test how their HTML templates will look with real data. Often, developers use third-party services to generate “Lorem ipsum” text, but now you can do that right in your editor.
The website will just create html for you to use.
BUT if you want to get some random data in your code try http://loremipsum.sourceforge.net/ which you can connect to your code directly.

Tool tip of the day - Colour Scheme Designer

For all you budding web disigners ... a nice easy way of determining what coulours you should have on your website.

http://colorschemedesigner.com
This site based on a colour wheel allows you to design a harmonious web site.
I particularly liked the ability to export the CSS & to get a colour chart for your web site.