Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a few questions corresponding to this.

  1. What is M2_REPO?
  2. What does this command do?

    mvn -Declipse.workspace=<your_workspace_location> eclipse:add-maven-repo

  3. Why do we need to do the above?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
268 views
Welcome To Ask or Share your Answers For Others

1 Answer

  1. M2_REPO is a variable that defines where maven 2 repository is on your disk
  2. This means: add definition of M2_REPO to XML file that defines the eclipse workspace
  3. You can do the same manually if you want. That is what I personally did. Just go to Window/Preferences and then choose Java/Build Path/Classpath Variables. Once you did it you can enjoy maven integration with eclipse. Every time you add new dependency to your pom.xml, run

    mvn eclipse:eclipse

and refresh you workspace you get all new libraries into classpath of your project.

EDIT

This answer was written 5 years ago. These days any eclipse distribution has maven plugin, so eclipse can open maven project directly. Every dependency you add to your pom.xml is automatically downloaded and almost immediately ready to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...