5 ms·
People say this but where do you find libs for Java? Python has pip, JS/Node has NPM
by kingkongjaffa 5y ago
People say this but where do you find libs for Java?
Python has pip,
JS/Node has NPM
- tlarkworthy 5y agoMaven central
- coldtea 5y ago>People say this but where do you find libs for Java? Everywhere, on the lib website, on GitHub, on Apache, etc. (including centralized places like Maven Central). You then put a ferences in your Maven or Gradle file like you would in your package.json. In fact, because for 99% of the libraries you just need to have a jar (or more) in your classpath, you don't have to have all the ceremony that Python has, and all the installation mess, venvs, and other such shite.
- Macha 5y agoUntil you end up with dependencies transitively pulling in conflicting versions of Jackson or similar and you need to mess around with dependencyManagement or exclusions.
- dionian 5y agoTransitive dependency trees are a feature, not a bug
- The_rationalist 5y ago
- deleted 5y ago[deleted]
- the_af 5y agoThe Java ecosystem of libraries is huge, it used to be one of the largest ones. I don't know how it competes today with Python and JS, but Java certainly doesn't lack libraries for almost anything you can think of. Also: Maven Central.
- smoyer 5y ago> JS/Node has NPM If this isn't a joke, I'd suggest learning the Maven or Gradle build systems. NPM has such horrible dependency management that these Java systems will seem like magic!
- chakkepolja 5y agoIMO maven is much better than gradle these days. Indeed maven or go dependency management is refreshing after you run create-react-app or shit like that.
- da39a3ee 5y agoOK, so I'm trying out maven central as people in this thread are recommending. As an example, I'm searching for a command line argument parser. The first thing I'm noticing is that there seems to be no way to judge the popularity of the libaries (an often-used proxy for quality, e.g. number of downloads, GitHub stars, etc). I enter "argparse" and the first hit isn't even Java! It seems to be a npm package?? https://search.maven.org/artifact/org.webjars.npm/argparse https://search.maven.org/artifact/org.webjars.npm/argparse I enter "argument parser" and there are two hits. One with zero stars on Github and one with 1 star. https://search.maven.org/artifact/com.github.easy-develop/argument-parser https://search.maven.org/artifact/com.github.easy-develop/ar... https://search.maven.org/artifact/com.github.raphcal/argument-parser https://search.maven.org/artifact/com.github.raphcal/argumen... "command line" brings up another 0 star option: https://github.com/AlmondBranch/command-line-parser https://github.com/AlmondBranch/command-line-parser I suppose the Java package ecosystem must be good if everyone says it is, but so far it looks to me like I'd find Maven Central very inefficient to discover high quality packages.
- Katharsas 5y agoMaven Central is the place where the libraries are hosted, but not the place where they are found by users. Use Google/Stackoverflow/Reddit and simply search for what you want. Searching for "command line argument parser java" immediately leads you to libraries and infact lists of libraries (see https://stackoverflow.com/a/7829772 https://stackoverflow.com/a/7829772), of which most are going to be available on Maven Central. Then you do your research that the library you are looking at looks valid and is trustable (!) by checking out the info available on it, maybe make another search to find opinions on it. Then when you have decided to try it, look at its docs to find out where it s located on Maven Central and use it from there.
- mindcrime 5y agoIn Java-land most people build and do dependency management with Maven or Gradle. In either case, these tools can pull from repositories based on the Maven format. The vast majority of popular libraries are in repo "Maven Central" and "just work" if added to your dependency list. A number of smaller, more specialized repos also exist, and it's trivial to add additional repos to your Maven/Gradle config as well. You can search for libraries on mvnrepository.com, or your IDE can search the index. Also most libraries will include a section in the documentation that shows the details of the blob you have to put in your pom.xml / build.gradle file.
- throwaway2037 5y agoTo compliment most other posters, they would use Maven Central: https://search.maven.org/ https://search.maven.org/ Here is an example library from Google called "Guava": https://search.maven.org/artifact/com.google.guava/guava/31.0.1-jre/bundle https://search.maven.org/artifact/com.google.guava/guava/31.... You can find the source code on GitHub: https://github.com/google/guava https://github.com/google/guava On the right side of the page, you can find eleven (!) different wants to include this dependency (and) all of its transitive dependencies with just a few lines of configuration. Here is a list of the Top 10 downloads of open source Java libraries: https://mvnrepository.com/popular?p=1 https://mvnrepository.com/popular?p=1
- tannhaeuser 5y agoErr ... the npm authors (the CommonJS modules/packages spec writers for package.json) mention maven and CPAN in their design docs and discussions as reference. Many of the early Server-side JavaScript adopters (in the 2000's before Node.js but well after Netscape's server-side JavaScript) were, in fact, Java/J2EE dropouts longing for something simpler. [1]: http://wiki.commonjs.org/wiki/Packages/1.0 http://wiki.commonjs.org/wiki/Packages/1.0
- thrower123 5y agoOne of the nice things about Java and C# is that they tend to have "chunkier" dependencies, that aren't split out into an interlocking tree of dependencies deep and wide. For the most part, anyway... Things are kind of gross if you are trying to use newer nuget packages on the old 4.8 .net framework...