Archive | Java RSS for this section

Pre-Merge Formatting


Merge Right

Merge Right

A problem with formatting code on a branch, is when you come to merge it back to the trunk, you end up having to work thorough lots of file changes which are really only formatting changes.  The larger your project size, the more work this involves.  I was faced with a similar task recently.

While editing file by file, I usually do the Ctrl-A Ctrl-Shift-F combo to ensure the file is formatted according to our corporate standards before saving any edits.  Since much of the code I touched on the branch was formatted under a different standard, and I touched a lot of files while introducing log4j logging, the end result was heading for a hairy merge.  What I really needed was a way to bulk format both the branch and the trunk versions of the code-base.

Luckily, I realised that that same formatter embedded in Eclipse can be used to bulk format Java source.  Here’s how …

Read More…

Swaying the Team to Innovate.


Innovation in Corporate America

Innovation in Corporate America

As I mentioned in Between a Rock and a Hard Place, our team is currently on the horns of a dilemma.  I likened our situation to racing on a flat tyre.  Do you stop and fix, taking the hit of lost time, or do you make a best effort to keep pace, almost blindly disregarding the situation.

I’ve just finished reading Sway (Brafman & Brafman, 2008).  It offers some additional insights into our situation.  For example, all my engineering training has been around technology.  How computers work, how software works, how to create good software, how software design works, how the software process works, etc.  As far as I remember, no time was given to group dynamics.  Since most non-trivial software requires a team to collaborate, one would think that taking the group into account would factor into software design and engineering.
Read More…

Between a Rock and a Hard Place


red car red rim black tire flat

red car red rim black tire flat

Jeff Atwood makes some good points regarding paying down your technical debt.  I certainly agree with many of his sentiments.

The problem is, refactoring takes time.  The best option is a little now, a little later.  Putting it off for long periods, will eventually come back to bite you.

I’m in the process of being bitten…

Read More…

The Perfect Build Setup – Hudson


Introduction.

I have had a passing acquaintance with Hudson for some time, but it is only recently that I’ve had to get down and dirty with it.  For one reason or another, much of the build infrastructure work for my current project has fallen on me.  This has allowed me to become much more involved with Hudson on a daily basis, and I have to say I’m loving it.

Hudson is a continuous integration environment.  We have configured it to check code out of our subversion repository on a regular basis, run the build scripts, gather the cobertura code coverage, junit test reports, findbugs reports, etc., and have these metrics published and trended over time.  I think I can speak for my team when I say, we’ve found it a boon to be able to regularly build our system in a clean environment, and gain such insight into our code quality.

So without further ado, I present instructions to allow you to set your own build system up in 20 minutes or less.
Read More…

Getting Subversion Revision in Ant – Part II



We have previously discussed getting the subversion revision number from an ant script.  While the previous method relied on antcontrib and regexes, I’ve recently come across the SvnAnt project.

SvnAnt is a contribution for ant, which allows for access to svn functionality from within your ant scripts.  Several of the svn operations are available, and are documented here.  Personally, I think that your build system shouldn’t be mucking around with your source control system, though it is useful to use the subversion revision number as part of your build numbering system.

<target name="find_revision" description="Sets property 'svn.info.lastRev' to head svn revision">
<path id="svnant.libs.path>
		<fileset dir="libs">
			<include name="svnant.jar"/>
			<include name="svnClientAdapter.jar"/>
		</fileset>
	</path>

	<!-- Load SvnAnt -->
	<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.libs.path" />    

	<!-- find head revision number, amongst other things. -->
	<!-- Replace svn_username and svn_password with values appropriate to your system -->
	<svn username="svn_username" password="svn_password" javahl="false">
		<info target="." />
	</svn>

	<!-- Display svn revision number -->
	<echo>Revision found: ${svn.info.lastRev}</echo>
</target>

Why Maven doesn’t work for me.



I’ve been meaning to do a follow up post on Maven for quite a while. I received several emails regarding my previous post from people asking how we’re using it. I must admit, it looked promising initially, but as we got into the specifics, it looked less workable for building commercial software. Here I hope to outline some of the reasons I suggest that Maven may not be for you.

Read More…

Getting Subversion Revision in Ant



Here’s a nifty Ant snippet. This can be used to get the Subversion revision number from your Ant build system. Using this, you can label your build artefacts, providing better visibility on what exactly is contained in each build.

<target name="find_revision" description="Sets property 'revision.number' to the head svn revision">
        <property name="revision" value="HEAD"/>

        <!-- find out revision number of HEAD, need svn.exe installed on local machine -->
        <exec executable="svn" outputproperty="svnlog.out">
            <arg line="log ${homedir}/.. -r ${revision} -q"/>
        </exec>

        <echo>${svnlog.out}</echo>

        <!-- need ant-contrib.jar for this in lib dir of ant install -->
        <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
        <propertyregex property="revision.number" input="${svnlog.out}" select="\1">
            <regexp pattern="r([0-9]*)"/>
        </propertyregex>

        <echo>Revision found: ${revision.number}</echo>
    </target>
Follow

Get every new post delivered to your Inbox.

Join 150 other followers

%d bloggers like this: