Reputation: 1531
I have a very simple question, I tried to search as well anyhow was not able to find right answer.
I am not sure if this could be done with maven or this is related to server deployments, I just need the right direction to proceed
I deploy apps on wild-fly there we just point to modules and we do not have any dependencies included in package it self.
In that way we do have to repeatedly load all dependencies in memory for every project. I know we can build a separate module for dependencies, but again when I build the actual project and include dependencies module all the dependencies will be included(Actual jars which increases size). I need to just point out to the existing dependencies on drive or use already deployed dependencies from server.
Suppose we have project A and Project B with below POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
</parent>
<!-- Additional lines to be added here... -->
</project>
I do not want to include org.springframework.boot to both projects, instead it should refer local repo after deploying in server or a separate module C which can be used by bot A and B provided A and B does not include actual jar files. Hope I am clear enough. Any help or suggestions are greatly appreciated.
Upvotes: 1
Views: 60
Reputation: 35785
Firstly, let me remind you that your approach has some drawbacks: If you put your dependencies in the server, upgrading a dependency immediately changes all deployed projects (because they rely on it), so you tightly connect all your projects.
If, though, you want a dependency to be provided by the server, you need to set the scope to provided
. That means you need to look at the list of dependencies that are defined by your parent POM (mvn dependency:list
) and then make entries in <dependencyManagement>
for each of the dependencies, adding <scope>provided</scope>
to filter them out when building.
Upvotes: 1