News for hackers. Stuff that matters.
Re:So you want to write a package manager by klodolph on Saturday February 13, 2016 @05:16PM (#11095885)
What would you say is the difference then, between Maven / Gradle and say, NPM? I haven't used JVM tools, but what you are describing sounds like how NPM works. You specify that your project needs library X, version 4.5, in your package.json file and then NPM handles the rest.
Re:So you want to write a package manager by tadfisher on Sunday February 14, 2016 @12:49AM (#11097286)
For one, you can't install system-level dependencies with Maven. `gradle install <foo>` simply isn't a concept. Dependencies you download for a project are confined to that project, and optionally cached for other projects dependent on the same versioned artifacts.

The end result is that there is no "global" dependency like you would install with `npm install <foo>`. There is no dealing with dependency mismatches between projects that depend on "<foo> >= 1.2" for example, which can be a hassle to track down in the "global dependency installation" model most often used by these language-level package managers.

Re:So you want to write a package manager by meddlepal on Sunday February 14, 2016 @01:01AM (#11097317)
IMO this, the Maven and Gradle way is the way it should be. Global dependencies are a nightmare.
Re:So you want to write a package manager by klodolph on Sunday February 14, 2016 @04:54AM (#11097727)
What you're describing for Maven is exactly how NPM works. You run `npm install foo`, it installs foo locally, for the project you are working on. Again, I am having a hard time understanding what people think is different between Maven and NPM.
Re:So you want to write a package manager by matzipan on Saturday February 13, 2016 @05:30PM (#11095960)
Used both, difference is non-existant. Not sure what parent means.
Re:So you want to write a package manager by dlandis on Saturday February 13, 2016 @06:12PM (#11096167)
It is similar, but you need to have npm installed first don't you? With gradle you typically interact with it through a shell script (aka gradle wrapper) and that downloads the correct version of gradle if it isn't already present in the project directory and then gradle downloads the dependencies. The person who sets up the project would generate the wrapper script using gradle.
Re:So you want to write a package manager by aikah on Saturday February 13, 2016 @07:34PM (#11096468)
> It is similar, but you need to have npm installed first don't you?

Same thing for gradle, you need to install it at first place. There is absolutely no difference except the language that is being used. And yes you can use shell scripts with npm too, except your shell scripts aren't going to run on windows.

Re:So you want to write a package manager by dikaiosune on Saturday February 13, 2016 @09:30PM (#11096875)
Does npm have this?

https://docs.gradle.org/current/userguide/gradle_wrapper.htm...

I think that's what GP was referring to -- it's not a shell script for automating use of the tool, it's a shell script for automating acquisition and initialization of the tool.

Re:So you want to write a package manager by aikah on Saturday February 13, 2016 @09:46PM (#11096917)
When you fetch a package with npm, the package will either be : a library(installed locally) or a command line tool (installed globally). You can also run any number of tasks per project (npm run <task>), described in the npm manifest, or execute tasks before or after installing, and before publishing a library.
Re:So you want to write a package manager by dikaiosune on Saturday February 13, 2016 @09:48PM (#11096927)
Right, but that doesn't address how you acquire/install/configure npm itself, which is one of the main benefits of having gradlew[.bat].
Re:So you want to write a package manager by TheAceOfHearts on Sunday February 14, 2016 @12:40AM (#11097277)
You need to have node installed already. Once it's installed you'll have npm because it's bundled with node.

I googled quickly for gradlew.bat and from the first link I opened it looks like it depends on java being installed already.

Node already includes npm because it's the official package manager. Java doesn't include gradle, presumably because they have multiple options and none of them is considered the official one?

Re:So you want to write a package manager by dikaiosune on Sunday February 14, 2016 @01:37AM (#11097389)
I wasn't aware of the implicit "if you have node you have npm" relationship -- thanks for clearing that up.