r/javahelp • u/ayi_ibo • 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?
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.
13
u/edubkn Nov 24 '21
Maven can be a little cumbersome and clunky
No, Gradle can be that. Maven is much more straightforward and easy to understand. It's just that it's xml.
4
u/msx Nov 24 '21
right? it gets so much undeserved hate. Gradle is much worst imho, ok it can do a little more but it will make you pay in tears for it. I don't even know how it gained so much popularity.
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)
0
Nov 24 '21
[deleted]
-8
u/le_bravery Extreme Brewer Nov 24 '21
Maven is the worst
3
u/Gaarco_ Nov 24 '21
Honestly they are both pretty bad, but the Java community is enthusiastic about everything Java related even more so if it's a fossil from 30 years ago that doesn't even support (and won't ever) new xml features for syntactic sugar.
Still waiting for a build tool that allows me to write build scripts in Java without having to learn other technologies to package a fucking jar.
1
u/ObscureCulturalMeme Nov 24 '21
I've never had a single good experience with Maven. Its insistence on trying to do what it thinks somebody else might want instead of doing what I fucking told it to do grates against my Unix soul. But good luck trying to get help from the rabid fanbois.
3
2
•
u/AutoModerator Nov 23 '21
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full
You ask clear questions
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.