Enterprise Java

Java Tip of the Week #7 – Maven Slow?

maven-slow-300x202This week Java Tip of the Week is a follow up of last session about Maven. The first video covered aspects related to Maven Dependencies. This video will cover some techniques to speed up your Maven build.

Maven Slow?

Since Maven 3, you are able to run your builds in parallel. Depending on the build machine and the project structure, you might get a 60% speedup increase!

Also, there are some ways to selectively pick just the things you want to build, using the -amd and -am flags. These are available since Maven 2, but for some reason they don’t seem to be used that much.

Check the video:

For reference, here are the commands:

CommandDescription
mvn clean install -T 1CBuilds the project with one Thread per Core
mvn clean install -T 2CBuilds the project with two Threads per Core
mvn clean install -T 4Builds the project with fours Threads
mvn clean install -pl [project-name] -amdBuilds just the project specified in -pl and all the dependent projects.
mvn clean install -pl [project-name] -amBuilds just the project specified in -pl and all the required projects to build it.

 
Check the Maven wiki page about Parallel Builds.

Also, check this other post I wrote: Maven Common Problems and Pitfalls.

Remember to follow my Youtube channel for faster updates!

Leave a comment if you enjoyed it, if not leave one as well!

Reference: Java Tip of the Week #7 – Maven Slow? from our JCG partner Roberto Cortez at the Roberto Cortez Java Blog blog.

Roberto Cortez

My name is Roberto Cortez and I was born in Venezuela, but I have spent most of my life in Coimbra – Portugal, where I currently live. I am a professional Java Developer working in the software development industry, with more than 8 years of experience in business areas like Finance, Insurance and Government. I work with many Java based technologies like JavaEE, Spring, Hibernate, GWT, JBoss AS and Maven just to name a few, always relying on my favorite IDE: IntelliJ IDEA.Most recently, I became a Freelancer / Independent Contractor. My new position is making me travel around the world (an old dream) to customers, but also to attend Java conferences. The direct contact with the Java community made me want to become an active member in the community itself. For that reason, I have created the Coimbra Java User Group, started to contribute to Open Source on Github and launched my own blog (www.radcortez.com), so I can share some of the knowledge that I gained over the years.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button