[Docker][Maven] How to add a local maven project as dependency to another maven project?

狂风中的少年 提交于 2019-12-08 12:59:38

问题


There are two maven projects - proejct1 and project2.

com.project1.Object1.class depends on com.project2.Object2.class, I want to add project2 as dependency to project1.

I know under certain IDE (such as Itellij) this is easy to setup, and I'm using IDE set-ups for development. But for production, I need to build project1 independent from any IDE-environment.

Also I'm using Docker. It would be nice if there is a way to simplify this problem in Docker.

- root
  - project1
    - src
      - com.project1.Object1.class
    - pom.xml
    - Dockerfile
  - project2
    - src
      - com.project2.Object2.class
    - pom.xml
    - Dockerfile
  - docker-compose.yml

回答1:


You reference different Maven projects in your pom.xml. If you build project2 with install, you can reference it (locally) from project1. If you use a repository like Nexus or Artifactory, you deploy project2 there and reference it from project1.



来源:https://stackoverflow.com/questions/45998700/dockermaven-how-to-add-a-local-maven-project-as-dependency-to-another-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!