RTC Java API with Maven
Hello,
I am trying to develop an application that makes use of the Java API. So far so good.
Unfortunately, the libraries that I need to include have to be added through Maven.
There are over 100 .jar files in the libraries, therefore making it very inefficient to add each one of them to my private Maven repository.
Because of that, I tried to repack all the jars into single.jar file. I uploaded the single.jar to my private Maven repo and everything seemed to work properly. But when I tried to run the code, a problem occured
in the following line of code
What is interesting here, is the fact that when exactly the same code is run from the plain java project where dependencies are not included through Maven but simply jars are put in the classpath, the code works as desired.
Therefore I would like to ask if any of you had used Java API libraries with Maven or experiences similar problems?
ANSWER:
I eventually solved the problem in a way very similar to the accepted answer. Unfortunately I had to upload all the required jars separately to the private maven repository (Nexus in my case). Since then I haven't experienced any difficulties (all the jars can be added with arbitrary artifactId, groupId, and version, however it is very useful to preserve the versions in case of an update).
Unfortunately this solution has quite large drawback - when RTC on which I work has been updated to version 5, API libraries changed and I had to upload new jar versions once again.
However I bet that better solution does not exist if you want to stay with simple java and stay away from workarounds like executing ant in maven etc.
|
Accepted answer
You might find it inefficient, but I find it necessary. Don't whinge, the WebSphere Process Server libraries for 6.0.2 contained 172 or so jars!
I add them all into my local maven repo mgr (Archiva, in my case) and I create a consolidation pom.xml that lists all jars, so I only have to include one dependency. In that manner, all code looks and feels as if it's been run with the normal platform libraries from within eclipse, even though it's from maven. The approach I take, is that I have a copy.bat file that copies all of the necessary jar files to a flat structure, and from there I have an install.bat or deploy.bat (to a remote repo). Why do I copy? So I can take them with me to another project. That way I only have to bear the pain once. Piotr Nadczuk selected this answer as the correct answer
|
One other answer
I know the pain, you can bet it.
I've solved in two ways with different clients, but it depends on how much flexibility you have. 1) Using RunAnt: run an ant inside a maven. Simply but not always accepted. 2) configure maven to access a file system path using system scope for repository Comments 1
Chris Graham
commented Apr 21 '15, 6:57 a.m.
I steer away from ant run unless you have no other option (IBM RAM integration).
As for system paths, only if you can always control locations, which is not always possible.
Yes, using the consolidation Pom approach needs to be redone per version but it only needs to be done once and it has the added advantage of it works! :-)
I might have been lucky, as I was the one providing the solution and they got what I gave them. :-)
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
In the "me too" category, I was trying the same thing with gradle but eventually gave up. It doesn't seem like this would be such a challenge but looks like it is.