Maven Assemblies

I spent a few days doing the pom.xml for a project. The difficulty was all these ancient libraries that the project depends on and that are not in any Maven repository. Ended up creating dependencies from my local repo and writing all the pom files for each library. Blamed it on the technical debt of this project.

One thing that I learned on this one was how to create the assembly file. This is very useful to bundle the project and be ready to deploy. This project is not a purely web app so we have all sorts of other files to bundle to be ready for deployment.

Maven has good documentation but when you are new to everything it takes a little while to sometimes find the right syntax to do what you want.

There was good documentation in this blog entry from Andrew E. Bruno to give me some basic understanding of what I needed to do. The key thing was that the assembly file needs to be in src/assemble and can be named as you wish. It also tells you what to add to your pom.xml to make this work.

I also had to read the Maven documentation about all the keywords that can be used in the assembly file. I wanted to remove the project name from the path in my tar.gz file. I simply needed to add:

<includeBaseDirectory>false</includeBaseDirectory>

right after the formats and everything was clean for my assembly process.

There is probably a few other things I will want to complete with other plugins but this is a good start to simplify the deployment of this project.

Advertisements

Published by

m5c

Java developper that loves photography and good coffee

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s