简体   繁体   中英

What exactly happens when you run mvn install?

I know that when you run mvn install it will compile, package, and copy the binaries in the local .m2 repository.

I recently created a maven project in intelliJ and ran mvn install . I then checked the .m2 repository and the generated binaries were there. When I tried to add a dependency to that newly created snapshot from another intelliJ project, they aren't being picked up.

  1. Any idea what is missing?
  2. Does anything happen in mvn install besides copying the new snapshot into .m2?

mvn dependency:tree is usually the best tool for figuring out what's going on with dependencies.

Sometimes with IDE's they use their own repo or don't pick things up. I'd generally do a sanity check mvn clean install from the command line to make sure things are working correctly.

Here is the default lifecycle of maven. When you execute one phase - all previous phases are executed before it. So if you call mvn install previous 21 actions will run before install phase which is 22.

  1. validate
  2. initialize
  3. generate-sources
  4. process-sources
  5. generate-resources
  6. process-resources
  7. compile
  8. process-classes
  9. generate-test-sources
  10. process-test-sources
  11. generate-test-resources
  12. process-test-resources
  13. test-compile
  14. process-test-classes
  15. test
  16. prepare-package
  17. package
  18. pre-integration-test
  19. integration-test
  20. post-integration-test
  21. verify
  22. install
  23. deploy

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