0

I have a Maven project 'Project A' which contains dependencies. I have a requirement to abstract the dependencies from this project into another project called 'Shared Lib' so that I can make what is called a "Skinny War" file from Project A. Both these files will then be uploaded to a Weblogic server.

However, I am having a lot of difficulties being able to get Project A to pick up the dependencies in Shared Lib.

Some guidance on how I should approach this problem would be much appreciated.

Thanks!

semiColon
  • 205
  • 6
  • 24

1 Answers1

0

I would split the maven project into two modules. If we call one module SharedLib and the second one Skinny War then you will have something like:

<modules>
    <module>sharedLib</module>
    <module>skinnyWar</module>
</modules>

In the shared lib module pom.xml you will fill all the dependencies required for the project. In the skinnyWar module your first dependency in the list will be for the sharedLib module. You might need to setup the assembly plugin for the sharedLib module to create a jar in the package phase and you are good to go ;)

Some food of though - do you really want to do this? An important part about using maven is to take care of dependencies for you and package a easy to deploy jar. If you create two different jars it would cause all other kinds of troubles like - were both deployed. Are we using an older version of the dependencies etc.

Veselin Davidov
  • 7,031
  • 1
  • 15
  • 23
  • Thank you for your response Vesselin, but I'm not sure that modules are what I am looking for. As the wars are to be deployed to a Weblogic server, it appears to be common practice to separate the dependencies from the application code, as an easy way of using the dependencies across multiple WAR's without any duplication of dependencies. – semiColon May 04 '18 at 11:17
  • I found a resource [link](https://www.igorkromin.net/index.php/2015/11/18/packaging-a-shared-library-using-maven-for-deployment-to-weblogic/) which I think is more along the lines of what I need, however it doesn't show how to include the shared library in the skinny war pom.xml. Would you have any ideas on how to do that? – semiColon May 04 '18 at 11:17