Create Sym Links in a Maven Assembly – Not Quite

It’s been a while but I’m back to my Maven tinkering. (By the way, I’m back to my usual posting too, did you catch that?) Tonight I discovered how to do the impossible. You see, I had this requirement from way back that I could never provide a clean solution for. I needed to build a custom tarball for the installation of a server application and the tarball needed to include symbolic links. I wanted to attack with Maven but the problem became how do you get a sym link into a Maven created tarball? After a little Googling I discovered the maven-junction-plugin. This plugin is brought to you by the same wonderful people that brought you the J2ME plugin for Maven. It allows Maven to create sym links on *Nix based systems and junctions on Windows systems. (These are the Windows sym link equivalent.) I haven’t yet gone as far to see if a Windows Junction would translate into a Linux sym link in a tar built from the assembly but I have managed to create a normal looking sym link on my Mac which should no doubt tar without issue. Wait, let me actually try this. Dang! No luck! Well I can at least create the symlink which is a good starting step. The assembly plugin does not seem to honor sym link copying into the tar… at least not with default options. There may be a hidden option that I can take advantage of. A little more research then maybe. For now I can work around using the assembly plugin to create the structure then running tar as a system command. Still not as clean as I’d hoped but getting there. I think I remember a sym link option in the Ant tar task. Stay tuned for the rest of the story. I’ll keep the good stuff coming.

2 thoughts on “Create Sym Links in a Maven Assembly – Not Quite

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s