Setting up M2_REPO classpath

后端 未结 3 1569

I have a few questions corresponding to this.

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

    mvn -Declipse.workspace=

3条回答
  •  一生所求
    2020-12-17 11:27

    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.

提交回复
热议问题