简体   繁体   中英

What is the equvalent of npm install in maven

i am new to java and have mainly used node.js for most of my projects. I have used npm and used the npm install function to download packages. In maven, is there a similar function that easily installs packages?

mvn dependency:resolve

Is worth take a look to mvn life cycles

There's also mvn dependency:go-offline to download the dependencies and prepare to run the rest of the tasks without any connection to the internet.

I was looking for a way to install maven dependencies during a CI job, while explicitly NOT compiling the code or running the tests.

Keep all the dependencies in your pom.xml (You can think of this as package.json ). If you are using an IDE like eclipse it will automatically download the dependencies for you. If you want to download the dependencies from the command line run mvn install . You can find the corresponding XML for dependencies here https://mvnrepository.com/

Maven doesn't have an install command. Before any task you run maven checks if the project was changed and downloads any new dependency you specified from Maven Central repository.

EDIT: Maven calls the resolver for most tasks you run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM