In Eclipse m2e, how to reference workspace project?

后端 未结 5 1688
一向
一向 2020-12-22 20:12

How can I reference another workspace project using Eclipse m2e?

Do I have to add a project dependency in the project setting? But in that case the depende

5条回答
  •  情深已故
    2020-12-22 20:41

    The correct way to do this is the following:

    • Use the dependencies section in the POM file exclusively, don't fiddle with the Eclipse project references. Right-click the project, then select Maven > Update Project Configuration to reset the project to the Maven default settings. This way, m2e has ownership of the dependencies.
    • Make sure all referenced projects are open in Eclipse and have the Maven nature enabled.
    • Check the Maven settings for each project, make sure that groupId, artifactId and version match with the projects you have open in Eclipse. So if the project you depend on has version 1.0.0-SNAPSHOT in Eclipse, make sure that the depending project's POM file references version 1.0.0-SNAPSHOT in the dependencies section.
    • Enable Workspace Resolution for each of the projects. Right-click the project, then Maven > Enable Workspace Resolution.
    • Finally, if the projects are still not resolved, right-click the project again, then Maven > Update Project

    This should solve your problem. If after this, your dependencies are still referenced from the file system, check the groupId, artifactId and especially version of each dependency again.

    Also check if you don't have any errors in your project - try to run Maven install.

提交回复
热议问题