How do you use Maven to share source code for two projects?

后端 未结 3 1694
陌清茗
陌清茗 2021-02-13 04:13

I have a large Java Web Application project using Maven and I need to start a new project that will share most of the same code (so I don\'t have to repeat work), but not all of

3条回答
  •  醉酒成梦
    2021-02-13 05:09

    You should refactor your projects.

    1. Identify the common code
    2. Extract that into its own maven module
      2.1. usually web-apps are multi module, so if you are going to share the common library across two web-apps, then separate the common library out into its own group-id
    3. Build and install the jar file into your repository
    4. change the poms of the web-apps to depend on your new library

提交回复
热议问题