Tag Archives: process

Jar Clean Up Story

I’m pretty happy with moving some common Java libraries out of the project source folders.

I have about 4 branches of the same project checked out. Each of them were about 57mb a piece. I noticed this while I was trying to sync my projects to a remote server. (I hate slow running scripts)

I managed to move the jar files out to a common folder which was about 27mb. I wrote another recursive ant clean script (which I will share below) that helped me clean up before the sync.

Moving the libraries was relatively simple with a few changes in the ant build scripts.

Anyway I managed to bring down each project to about 10mb. Here is the recursive ant clean script.


#!/bin/bash

projects=~/projects

for project in $(ls $projects/);
do
if [ -f $projects/$project/build.xml ]; then
echo ""
echo "Cleaning $project"
cd $projects/$project
ant clean
fi
done

I tried a similar script in Windows batch, didn’t work as easily. Don’t need bat files, Cygwin is better. And the same bash shell scripts on Linux most of the time with little or no modification.

For a programmer tweaking never stops. I try not to work on Sunday. But its a good day to take a step back and do backups, cleanups etc.

I knew about this jar duplication but really saw it while trying to run a backup and then looking at the projects folder with jDiskReport. Need more tools like this.

Make Windows Shortcuts with Cygwin

Did you know that you can make Windows shortcuts with Cygwin and ln? I did not know this, just tried it out today and it works!

This is probably the smallest thing I’m blogging about, but read on you might get some new ideas (like I did) about file organization in Windows. I swear some days Cygwin is the only thing that keeps me sane on this office Windows XP computer.

I like to keep my /projects folder separate from my /clients folder. It just saves clicks I guess and I’m a separation junkie I can’t help it. I could have manually created these shortcuts for each project but now I can do it in a bash script. Yay!

Still not following? Let me explain. I have a clients folder like this.


/clients/a/projects/a
/clients/a/projects/b
/clients/b/projects/c
/clients/a/projects/d

But I like to keep my projects in a root level projects folder like this for easy access and backups etc.


/projects/a
/projects/b
/projects/c
/projects/d

I have simple, unique, short project names. That helps a lot. Here is the magical command that can help me a great deal.


ln -s /cygdrive/d/clients/a/projects/a /cygdrive/d/projects/a

This way I can keep projects I’m currently working on in /projects and move others back to /clients/x/projects. Ideas for a project folder management script is brewing will post about that later.