Is it important to use Maven in Spring MVC project

2019-08-20 08:17发布

问题:

I just started developing a project in Spring MVC and i want to know how important Maven is.

回答1:

The following are the key features of Maven :

  1. Simple project setup that follows best practices - get a new project or module started in seconds
  2. Consistent usage across all projects - means no ramp-up time for new developers coming onto a project
  3. Superior dependency management including automatic updating, dependency closures (also known as transitive dependencies)
  4. Able to easily work with multiple projects at the same time
  5. A large and growing repository of libraries and metadata to use out of the box, and arrangements in place with the largest Open Source projects for real-time availability of their latest releases 6.Extensible, with the ability to easily write plugins in Java or scripting languages
  6. Instant access to new features with little or no extra configuration
  7. Ant tasks for dependency management and deployment outside of Maven
  8. Model based builds: Maven is able to build any number of projects into predefined output types such as a JAR, WAR, or distribution based on metadata about the project, without the need to do any scripting in most cases.
  9. Coherent site of project information: Using the same metadata as for the build process, Maven is able to generate a web site or PDF including any documentation you care to add, and adds to that standard reports about the state of development of the project. Examples of this information can be seen at the bottom of the left-hand navigation of this site under the "Project Information" and "Project Reports" submenus.
  10. Release management and distribution publication: Without much additional configuration, Maven will integrate with your source control system (such as Subversion or Git) and manage the release of a project based on a certain tag. It can also publish this to a distribution location for use by other projects. Maven is able to publish individual outputs such as a JAR, an archive including other dependencies and documentation, or as a source distribution.
  11. Dependency management: Maven encourages the use of a central repository of JARs and other dependencies. Maven comes with a mechanism that your project's clients can use to download any JARs required for building your project from a central JAR repository much like Perl's CPAN. This allows users of Maven to reuse JARs across projects and encourages communication between projects to ensure that backward compatibility issues are dealt with.


回答2:

Getting started with maven only takes about 10 minutes. Reasons why you should learn maven:

  1. It helps you manage your dependencies very easily so you don't need to add jars to your project classpath manually
  2. You can run unit tests
  3. Has over 20 useful plugins which you can use. Plugins make up lifecycles like test, package which make your work more efficient
  4. You can use it to build your project

The most important thing about it at the beginning is that you don't need to worry about setting up your project by adding dependencies, maven does it for you automatically.

Read this spring guide for building with maven

Any other guides in this section for spring boot has the same mechanism