0

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?
Dan Oberlam
  • 2,435
  • 9
  • 36
  • 54
Dinusha
  • 21
  • 3
  • for the mvn install question: http://stackoverflow.com/questions/10533828/what-does-mvn-install-in-maven-exactly-do – Jelle Jul 31 '15 at 15:41
  • Possible duplicate of [What does mvn install in maven exactly do](https://stackoverflow.com/questions/10533828/what-does-mvn-install-in-maven-exactly-do) – Ashutosh Srivastav Aug 08 '18 at 07:28

2 Answers2

1

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.

RLZaleski
  • 616
  • 6
  • 17
1

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
ka4eli
  • 5,294
  • 3
  • 23
  • 43
  • So instead of mvn clean install, its perfectly ok to use mvn install because clean phase always execute before install phase. Am I correct? – Dinusha Aug 06 '15 at 11:36
  • do you see clean in this list? There is another lifecycle for clean) Read this https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html – ka4eli Aug 06 '15 at 11:39
  • @Dinusha, http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – ka4eli Aug 06 '15 at 16:10