1

I have used Eclipse for some time (just for general java development) and now I am trying to understand the added features that STS brings, and also learn Spring Boot development. I see that when I create a Spring Boot project it always wants me to select Maven or Gradle as the build tool but I'm not sure why or what that does.

I just don't fully understand what Maven is doing when I'm working in the environment. Eclipse always compiled the code and did other things for me by invoking the compiler and I never needed an external build tool like ant or Maven or whatever.

So is it just making a Maven configuration in case I want to build the application outside the Eclipse environment or does STS rely on an external build tool?

Jim Archer
  • 1,337
  • 5
  • 30
  • 43
  • Maven does what Maven always does; someone will probably be along soon with the duplicate. In particular, it provides dependency management and a consistent build specification that can be run by a script or CI server without Eclipse. – chrylis -cautiouslyoptimistic- Jul 07 '15 at 21:31
  • I think the basic question you're asking is "Q: Do I absolutely need Gradle or Maven to build a "Hello world" Spring app in Eclipse?" A: No. But it *is* a good habit to get into - because you likely *will* be using Maven (or equivalent) for "real" projects. – paulsm4 Jul 08 '15 at 22:38
  • Good points everyone, thanks. – Jim Archer Jul 09 '15 at 18:48

1 Answers1

1
  1. For small, "Hello world", projects simple Eclipse compile/debug is more than good enough.

  2. Maven is "higher level" than "make/makefile" (the classic C/C++ build tool) or "ant/build.xml". Specifically:

Why maven? What are the benefits?

  • Henning:

quick project setup, no complicated build.xml files, just a POM and go

all developers in a project use the same jar dependencies due to centralized POM.

getting a number of reports and metrics for a project "for free" reduce the size of source distributions, because jars can be pulled from a central location

  • Emmanuel Venisse

Lot of goals are available so it isn't necessary to develop some specific build process part contrary to ANT we can reuse existing ANT tasks in build process with antrun plugin

  • Jesse McConnell

Promotes modular design of code. by making it simple to manage mulitple projects

it allows the design to be laid out into multiple logical parts, weaving these parts together through the use of dependency tracking in pom files.

Enforces modular design of code. it is easy to pay lipservice to modular code, but when the code is in seperate compiling projects it is impossible to cross pollinate References between modules of code unless you specifically allow for it in your dependency management... there is no 'I'll just do this now and fix it later' implementations.

Dependency Management is clearly declared. with the dependency management mechanism you have to try to screw up your jar versioning...there is none of the classic problem of 'which version of this vendor jar is this?' And setting it up on an existing project rips the top off of the existing mess if it exists when you are forced to make 'unknown' versions in your repository to get things up and running...that or lie to yourself that you know the actual version of ABC.jar.

Strong typed life cycle there is a strong defined lifecycle that a software system goes thru from the initiation of a build to the end... and the users are allowed to mix and match their system to the lifecycle instead of cobble together their own lifecycle..

this has the additional benefit of allowing people to move from one project to another and speak using the same vocabulary in terms of software building

  1. At an even higher level, Maven is a preferred build system for organizations interested in "ALM" ("Automated Lifecycle Management"), "CI" (Continuous Integration"), "CLM" ("Continuous Lifecycle Management") and/or "Devops":

https://www.ibm.com/developerworks/community/blogs/nfrsblog/entry/DevOps_best_practices_a_6_part_series?lang=en

DevOps (a clipped compound of "development" and "operations") is a software development method that emphasizes communication, collaboration (information sharing and web service usage), integration, automation, and measurement of cooperation between software developers and other IT professionals.[1][2] The method acknowledges the interdependence of software development, quality assurance, and IT operations, and aims to help an organization rapidly produce software products and services and to improve operations performance.

  1. For "serious" projects, your organization (consisting of many developers, possibily distributed geographically) will integrate your project with a DevOps toolkit like Sonatype Nexus or Artifactory. Which, in turn, typically use Maven to automate project build and runtime dependencies.

  2. But even for relatively "simple" Spring projects, you'll probably learn to appreciate the convenience Maven can bring to your builds (and corresponding JUnit tests).

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190