bw6-plugin-maven
bw6-plugin-maven copied to clipboard
What is the correct way to deal with shared modules?
This is what I found by going through https://github.com/TIBCOSoftware/bw6-plugin-maven/wiki/SharedModule and some of the issues.
-
In studio, go to Windows> preference and make sure you see this entry. If not then add it and restart studio.

-
Open shared module, right click and generate pom for shared module.
-
Right click the pom > Run as > Run configurations > select shared module as the base directory > give goal "install" This failed for me. This is the error. error.txt This is the shared module. BWCommon.zip
Let us say I am able to fix the installation. Then I should see the shared module jar under .m2 location.
- Now remove the shared module from workspace and open the application module.
- Right click the module > maven > add dependency > provide the shared module details. If it is present in the .m2 then I should be able to see it. select it.
- Right click application > generate pom.
- Right click parent pom > rus as > Run configurations > select parent dir as the base directory > give goal "clean install"
For doing this on jenkins, create one job for shared module, one for application.
- shared module job will checkout the shared module, refer the shared module pom and install it in the .m2 location of jenkins server.
- application job will checkout the application, detect dependency on shared module, find the shared module in .m2 location and use it.
- Are the steps mentioned above correct or did I miss anything?
- Can someone please help me with the error I am getting with the installation of shared module pom in .m2 ?
Hi @aalapargekartibco The error - [ERROR] Caused by: java.lang.IllegalArgumentException: Can not set org.eclipse.aether.spi.log.Logger field org.apache.maven.repository.internal.DefaultVersionResolver.logger to org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory should get resolved once you add maven 3.6.x in maven installations via eclipse preferences. Please ensure that you select the added maven installation as default. The steps mentioned looks fine.
@vpawar-ai I did this:
-
Imported shared module into workspace , generated pom and installed. I see the shared module jar in my local .m2.
-
Deleted everything from workspace and imported application.
-
right click application module to add dependency, don't see that option. For the "add dependency" option to come, there should be pom.xml under application module. So the "generate pom for application" by right clicking application has to be done first. To do that either the shared module or its binary should be imported into workspace. So I imported the binary and generated pom for application.
-
Now I am able to add dependency in the application module.
-
the pom.xml under module now shows the shared module dependency.
-
but the pom.xml under parent points to the actual shared module using relative path under the "modules" tab because of the "generate pom for application" step.
-
On Jenkins, the build failed because the parent pom.xml is looking for the actual shared module using relative path.
Can you please tell me what am I missing?
@vpawar-ai I removed the shared module reference manually from the parent pom. And it worked. Is there a way to prevent the shared module reference from appearing in the parent pom in the first place?
@aalapargekartibco There are 2 ways to use shared modules -
-
Shared Module with Maven (Use as child module in the parent project) - The Shared module project should be present in the workspace and the POM generation wizard will pick it, mavenize the project and generates pom.xml. The shared module is included as child module in parent pom.xml.
-
External Shared Modules with maven - The external shared module is added as pom dependency in application module. The steps you should follow -
- Create Shared Module Project. Use "Generate POM for Shared Module" option.
- Execute
mvn clean installto install the shared module jar into local m2 repository. - Create new eclipse workspace. Import your application project. (Do not import shared module project)
- Launch "Generate POM for Application" wizard and mavenize the application project.
- Open application module's "pom.xml" and add pom dependency(as explained at - https://github.com/TIBCOSoftware/bw6-plugin-maven/wiki/SharedModule#step-5). Save the changes. This should import external shared module project in "read only mode" in your workspace.
- The External shared module will not be added as module in parent's pom.xml. It will be used as pom dependency in application module.
@vpawar-ai These steps that you mentioned are not working for me: Create new eclipse workspace. Import your application project. (Do not import shared module project) Launch "Generate POM for Application" wizard and mavenize the application project.
When I try to generate pom I get this error

It is not letting me generate the pom without importing the shared module
@aalapargekartibco You are seeing this error because the shared module project is added in the <Your-application-project>->Package Unit->Includes. So the POM generation wizard expects it to be present in the workspace. Please remove it from the includes list and add it as POM dependency as explained in the steps.
Please note the difference between using Shared module as maven child Module vs adding External Shared Module as POM dependency.
@vpawar-ai I removed the shared module from the "includes" section of the application and generated the pom. I am now getting this error in the project.
Description Resource Path Location Type Project build error: Non-readable POM C:\git\Tibco-SalesForce\SalesForce\SalesForce.application.parent\pom.xml: input contained no data pom.xml /SalesForce line 1 Maven pom Loading Problem
Description Resource Path Location Type Project build error: Non-readable POM C:\git\Tibco-SalesForce\SalesForce\SalesForce.application.parent\pom.xml: input contained no data pom.xml /SalesForce.application line 1 Maven pom Loading Problem
These are the values that I provided while generating pom.

Is there anything in here that needs to be mentioned and I did not mention?