user12103456
user12103456

Reputation:

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?

Upvotes: 9

Views: 3438

Answers (4)

Kyle Pittman
Kyle Pittman

Reputation: 3097

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.

Upvotes: 4

Mohammad Faisal
Mohammad Faisal

Reputation: 693

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/

Upvotes: 0

Fran
Fran

Reputation: 351

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.

Upvotes: -3

osdamv
osdamv

Reputation: 3583

mvn dependency:resolve

Is worth take a look to mvn life cycles

Upvotes: 5

Related Questions