[英]Java dependency management for nodejs developers
I have been writing code in node.js now for sometime, and node has this nice package manager called npm
To install a package, I simple do npm install pkg-name
and there it is, in my node_modules
folder. 我现在已经在node.js中编写代码已有一段时间了,node具有一个名为
npm
不错的软件包管理器。要安装软件包,我只需执行npm install pkg-name
并且在我的node_modules
文件夹中。 There is a package.json
file with all my dependencies listed. 有一个
package.json
文件,其中列出了我的所有依赖项。
I need to write some Java code and Maven seems to be a popular dependency management tool for Java. 我需要编写一些Java代码,而Maven似乎是Java的流行依赖管理工具。 Although, I had a bit of a tough time wrapping my head around it.
虽然,我在这方面有些困难。
I want to know what are the analogous things in Maven
to npm
. 我想知道
Maven
和npm
什么npm
。
So, what's the equivalent to npm install pkg-name
in Maven? 那么,在Maven中相当于
npm install pkg-name
呢? Where do I find the dependencies? 在哪里找到依赖项?
npm
has a nice web ui, something like that for Maven? npm
有一个不错的Web ui,类似于Maven吗?
Any hello world projects for Maven that I can see? 我可以看到Maven的任何Hello World项目吗?
In my opinion, maven does more that npm, by that it can manage not only dependencies, but also the entire build and deployment process. 我认为,maven不仅可以管理npm,还可以管理整个依赖关系,还可以管理整个构建和部署过程。 it also integertad with most IDE's like idea or eclipse to make life much easier.
它也可以与大多数IDE(如IDE)或Eclipse结合使用,以使生活更加轻松。 I suggest you'll start with some maven tutorial, like this one , it will give you a good grasp of how to start
我建议您先从一些Maven教程开始,像这样的教程,它将使您很好地掌握如何开始
regarding hello world project - one feature you have in maven is to create a project from an archetype - you can try that out, will give you a good way to look how maven configuration looks like 关于hello world项目-您在maven中拥有的一项功能是从原型创建项目-您可以尝试一下,这将为您提供一种很好的方式来查看maven配置的外观
In maven you don't install packages, but you write all your dependencies in pom.xml. 在maven中,您无需安装软件包,但可以将所有依赖项都写入pom.xml中。 And those are downloaded and used during the build (when you do eg
mvn clean install
) 那些都是在构建期间下载和使用的(例如,执行
mvn clean install
)
pom.xml is a description of your project (eg it contains what dependencies are used, which compiler version, what is the project name, resulting binaries, etc.), there is a description of POM with examples here: https://maven.apache.org/guides/introduction/introduction-to-the-pom.html pom.xml是对您的项目的描述(例如,它包含所使用的依赖项,哪个编译器版本,项目名称是什么,生成的二进制文件等),此处带有示例的POM描述: https:// maven .apache.org / guides / introduction / introduction-to-the-pom.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.