How to tell Maven to include the jar dependency, not the subproject source directory in Eclipse?

后端 未结 6 1457
情歌与酒
情歌与酒 2021-02-13 11:11

I use Apache Maven to manage my Java libs (jar) and some of projects that use the libs. For convinience, I use mvn eclipse:eclipse to generate Eclipse project f

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-13 11:38

    I have recently experienced that this behaviour is triggered by the version stated in the pom.xml files. If the version of the lib your primary project is depending on is available to eclipse in the workspace (e.g. a project with the matching pom.xml [group,artifact,version] for the lib) this will be used as a project reference in stead of being pulled from the M2REPO-location.

    My solution was to change the version of the library pom.xml in the workspace to another version allowing me to improve the lib, while the primary project still pulled the older lib from M2REPO.

    Using this by aligning the version numbers allows you to perform concurrent artifact improvements/alterations with little hassle.

    I have not yet tested if you need to run the mvn eclipse:eclipse every time you change the lib pom.xml files and the primary pom.xml dependencies, but I would expect it to be so.

提交回复
热议问题