DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Java
  4. More New Cool Features in Maven 3 - Parallel Builds

More New Cool Features in Maven 3 - Parallel Builds

John Ferguson Smart user avatar by
John Ferguson Smart
·
Sep. 09, 10 · Interview
Like (0)
Save
Tweet
Share
13.06K Views

Join the DZone community and get the full member experience.

Join For Free

One of the big focuses of Maven 3 is to provide a more reliable, more stable and better performing build tool. And one big area of improvement is Performance.

Maven 3 has the (new and somewhat experimental) ability to analyze your project structure, and the dependencies between your modules, to figure out which modules can be built in parallel. This has major performance implications for larger multi-module projects - the documentation reports typical speed increases of 20-50%.

To configure your modules to be built in parallel, you need to tell Maven how many threads you want to work with. The following command will run Maven using 4 threads:

mvn -T 4 clean install

Or you can get Maven to calculate how many threads to run, based on the number of available CPU cores. In this example, Maven will run up to 2 threads per core in parallel.

mvn -T 2C clean install

The biggest speed increase comes from tests. Of course, not all tests can be run in parallel - if two modules both start up a web server on the same port, for example, you will get yourself into trouble. Speed increases will also depend on how your tests are distributed through your modules - if all the slow ones are together in one module, for example, speed increases are likely to be limited. In this case, you might want to also try running your unit tests in parallel.

From http://weblogs.java.net/blog/johnsmart/archive/2010/09/07/more-new-cool-features-maven-3-parallel-builds

Apache Maven

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Test Design Guidelines for Your CI/CD Pipeline
  • DeveloperWeek 2023: The Enterprise Community Sharing Security Best Practices
  • What Is Continuous Testing?
  • Little's Law and Lots of Kubernetes

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: