问题
I have developed two Springboot michroservices ex- service1 and service2. service2 microservice having dependency of service1.
I've added dependency of service1 in service2 pom file and working expected in eclipse while running service2. but when I deployed in Jenkins and I've created project(Jenkins Job) for service1 and ran with maven goal 'clean install', project builds successfully.
When I created project(Jenkins Job) for service2 and running the Jenkins Job, build is failing because service2 is not able to find the dependency of service1.
回答1:
Issue Resolved!!! whenever we are using spring dependency in depedent project we don't need to add maven/spring compiler plug-in.
回答2:
Your jenkins should be configured with an artifact repository like Nexus, if this is the case make sure the maven config of your project is set to publish the artifact to the repository.
On the other hand, it's not a good practice to make dependencies between microservices. Instead communications could be done via other protocols REST/HTTP,...
来源:https://stackoverflow.com/questions/57768517/spring-boot-microservice-depends-on-another-microservice-in-jenkins