Article 342EM CodeSOD: The Anty Pattern

CodeSOD: The Anty Pattern

by
Remy Porter
from The Daily WTF on (#342EM)

An anti-pattern that shows up from time to time here is the old "our IDE's build output is mapped to a network drive on the web server", but "Drummer" shows us a novel new variation on that theme.

It all started when a co-worker asked them, "how do I change the compiler version?" The code was built using Ant, so "Drummer" opened the build file and searched through it for a javac element- the Ant command which runs the Java compiler.

They didn't find anything, but after a more manual search, they found this:

 <target name="create_xxx_jar" depends="get_svn_info"> <jar destfile="dist/${xxx.jarfile}" manifest="manifest.mf" > <fileset dir="bin"/> <fileset file=".classpath"/> <fileset file=".project"/> <fileset file="manifest.mf"/> </jar> </target>

This bit of scripting code creates the output jar file containing all the compiled classes. Note that it does this by pulling them straight out of the bin folder. How do they get into the bin folder? Because Eclipse was configured to compile on every save. Note, the script doesn't check that there's anything in the bin folder. It doesn't check that the compile was successful. It doesn't wait for a build to complete. By default, those are debug builds.

And this output jar is exactly what gets shipped to the customer. You'll be shocked to learn that there's no automated testing or CI here.

That is their deployment process. Hit save. Run Ant. Scoop up the jar and ship it.

proget-icon.png [Advertisement] High availability, Load-balanced or Basic - design your own Universal Package Manager, allow the enterprise to scale as you grow. Download and see for yourself! TheDailyWtf?d=yIl2AUoC8zAApDpfEvNhHE
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments