简体   繁体   中英

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

There are two maven projects - and .

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 . 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM