• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Build Software

 
Greenhorn
Posts: 7
1
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to programming in general. As I've done research on different aspects of java I've run into mention of Ant, Maven, Gradle etc. I was just wondering when/if I should worry about transitioning from just compiling to using one of these tools?

Edit: Thanks for moving my post, sorry I didn't realize there was a dedicated section (I mostly lurk in beginners forum section).
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you are just writing small programs that consist of only one or just a few source files, it's easy enough to compile them manually using javac on the command line.

But when you are starting to write larger programs that consist of many more classes and source files, it's going to become cumbersome and hard to compile them manually. And if your program is using external libraries (JAR files) then it becomes hard to keep track of it all.

Build tools like Ant, Maven and Gradle are there to manage the build process for you when your project becomes bigger and more complicated. There are ofcourse differences between these tools, but the general idea is that you write a file that describes what your project looks like and how it should be compiled. When using Ant, that would be the build.xml file, when using Maven it's pom.xml and when using Gradle it would be build.gradle.

Once you have this definition file, all you have to do is run your build tool, and it will read the definition file and build everything in the right order, include the necessary libraries in the classpath etc., and maybe do other things like automatically run unit tests.

Maven and Gradle also have dependency management, which means that they can automatically download and manage libraries for you. For example, when you want to use Joda Time version 2.6 in your project, the only thing you have to do is specify this in your pom.xml and Maven will automatically download it and include it in your project.

When you are just starting learning Java, concentrate on writing small programs first and just compile your code by hand. When you are at the point where you want to start with a bigger or more complicated project, then invest some time into learning one of these build tools. I'd prefer Maven or Gradle; Ant is considered a bit more old-fashioned nowadays.
 
Alex Hintz
Greenhorn
Posts: 7
1
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Between Maven and Gradle, which is "easier" to learn?

Correct me if I'm wrong but Maven enforces a project structure and Gradle can be modified in either Java or Groovy. Which language is used in Maven and is using a enforced file structure a benefit when not working on industry projects?

Thanks once again in advance.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic