r/javahelp • • Nov 23 '21

Codeless Does java have a package manager?

I have been developing test automation projects on C# and Python for a while. I am using NuGet/PiP to install dependencies such as Selenium.

I will be switching to another company and they use Java stack. I am trying to understand how java environment works.

What is the easiest way to install dependencies on Java?

Are there any easy to use package managers for java that I can use?

25 Upvotes

12 comments sorted by

View all comments

44

u/_Atomfinger_ Tech Lead Nov 23 '21

Maven or Gradle.

3

u/wheezymustafa Nov 23 '21

This is the correct answer. Maven can be a little cumbersome and clunky but is widely used by many organizations and there’s a shit ton of documentation.

I haven’t seen gradle* used as much in a professional setting but it seems a little less verbose than maven. They both achieve the same outcome though.

1

u/huntsvillian Nov 23 '21

/u/wheezymustafa is correct. At least in the maven world, the dependencies are listed in pom.xml (largely the equivalent of package.json). I think gradle uses a .gradle file (maybe?).

Either way the underlying concept is basically the same. Where JS uses npm as the sort of global dependency storage, they are both backed by repo1 (aka https://repo1.maven.org/) though that can be overridden via configuration if you want to use a different mvn repo. We use a local install of Nexus as a package manager at work for both java dependencies and npm dependencies (if we have any)