Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the motivation of using Maven? Can I just create a build script instead?

Tags:

java

maven

According to What is Maven the objectives are:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

Can I just make a build script in bash instead?

What is the motivation of using a maven project? Is there any example?

like image 669
TheOneTeam Avatar asked Sep 02 '11 05:09

TheOneTeam


2 Answers

Maven also does dependency management pretty well. This is one of the bigger selling points, but there are a lot more.

It also helps to enforce a standardized project structure. The beauty in that is that I can pick up any mavenized project and pretty much immediately know where all the various files are.

Maven also has a pretty extensive library of plugins that allow for quite a bit... from automating static code analysis (via pmd/findbugs/checkstyle, etc), calculating test coverage, generating javadocs, generating source jars, running a web app in Jetty, etc, etc.

I will tell you that it's not exactly an easy tool to learn, but if you do master it, you learn to appreciate all it can do. If you want me to go into specifics about anything in particular, let me know.

like image 200
Paul Dunnavant Avatar answered Oct 30 '22 22:10

Paul Dunnavant


Maven is a tool that handles a lot of the boilerplate project setup and configuration for you. For example, if you wanted a Java project to properly integrate with a build server, provide code coverage information, and produce a jar file that can easily used in other projects around your organization - you could spend weeks setting this up manually using ANT, or you could just 'embrace' the Maven way of doing things.

In addition, you can setup archetypes (and many already exist) that are pre-configured projects for your desired setup. This can be a great way to enforce standards and increase productivity within an organization.

Maven does provide rules that are a bit rigid, but in the end it greatly cuts down on the time required to do many different tasks. I would recommend Maven: The Definitive Guide from O'Reilly as a resource to review.

like image 31
dtuckernet Avatar answered Oct 30 '22 22:10

dtuckernet