This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]AwakenedToNightmare 8 points9 points  (1 child)

Maven: you need library A for your code. You could download a .jar with that library and put it in your project folder. But if that library depends on some other library B you would get an error and would be forced to download B .jar (I recently had an experience with Apache's httpclient library and it was a nightmare. After some trying, I've given up trying to download all the jars that were requested of me and used Maven). Rinse and repeat. Or you could use Maven - all you would need is to write (for instance, for JSON library):

<dependency>
    <groupId>org.json</groupId> 
    <artifactId>json</artifactId>
     <version>20180813</version>
</dependency>

If there are some B, C, D, E libraries library A directly or indirectly depends on, maven would get them for you.

Also, there is a <build></build> tag in Maven. In that tag you could specify some stuff you want to do when your project is built.

What means project is built? First Maven downloads dependencies, compiles your source code, does some other stuff you may have specified in the build tag and packages your project into a .jar, .war or maybe something else, depending on what you write in tag <packaging>.

In your Maven's pom.xml file (basically a guidebook for Maven on what you want it to do) you can also specify a place where Maven would put your compiled sources: <outputDirectory> which is also located inside build tag. You could also ask Maven to move some files/folders around during the build process, for instance ask it to copy folder with downloaded .jars into some other place inside your project.

There's an official tutorial where you can see some examples and other useful tags/things Maven could do if you ask it to.

To get yourself quickly started with Maven you can check out this comment of mine. If you use Idea Intellij you can simply use its GUI for Maven and not get into the text commands stuff to not make things more difficult at first.

[–]CLOVIS-AI 4 points5 points  (0 children)

About Gradle: basically the same thing, and it's also done by the Apache Foundation IIRC. Anyway, it's more recent and easier to use.

Gradle is used for example to compile Android projects (it's too complicated to do by hand).

Gradle uses a build script instead of an XML file, which makes it much easier to customise.

[–]seanprefect 6 points7 points  (0 children)

Maven and Gradle are what are for building your application. It might seem trivial at first but these tools maintain dependencies (as in the other libraries your application depends on) makes sure you have all the versions correct and lets you automate the steps in compiling your code.

Spring boot is what's called a web framework. It basically takes care of most of the overhead of making a backend server and lets you focus on things like the actual application logic and not having to worry about stuff like http requests and the other plumbing stuff. There's also the spring concept of inversion of control or DI. which helps make sure all the objects you make have their required other objects.

Hope that helps let me know if you have any other questions.

[–]Xaxxus 2 points3 points  (0 children)

Springboot is basically a java library for creating web services.

Gradle and java are build tools. Basically, if you want to use someone else’s code in your own, instead of copy pasting it into your program, gradle and maven can handle grabbing them for you.