问题
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