Proper way to refer to external libraries [message #1760661] |
Sun, 30 April 2017 15:41  |
Eclipse User |
|
|
|
What is the "clean" way to refer to a public library used in a binding? I noticed that many bindings just include the library manually in a lib folder but I assume it would be better to use a reference to a repository. Unfortunately, I am not an Eclipse/Maven/Tycho expert and everything I tried broke the project configuration and generated a cascade of other issues. I realize this is not an ESH question per se but ESH is tightly tied to Java/Eclipse/Maven/
I thought the whole point of the POM file was to manage such
dependencies so I added the repository (central.maven.org/maven2/) and a reference to the artifact I am using (org.snmp4J) ... but that had no impact. So I also converted the project to a maven project and then the additional repo appeared among the maven repos. But the imports in the code were still all red-lined, the "search repository" command did not find the reference. Also Eclipse started to ask about a missing Tycho plugin. I
|
|
|
Re: Proper way to refer to external libraries [message #1760709 is a reply to message #1760661] |
Tue, 02 May 2017 05:43  |
Eclipse User |
|
|
|
Of course you are right in saying that the "cleanest" approach would be to reference a repository. However, there are two things to notice in that context:
1. Our build is not based on "plain" maven as you might be used to, but we are using Tycho, which essentially are some maven plugins which make maven behave as close as possible as the model promoted by the Eclipse IDE, i.e. it respects the MANIFEST.MF files and sets up the classpaths accordingly. Therefore, dependencies in the pom.xml files cannot be referenced as easily as it would be with plain maven. Instead, such an additional dependency would need to be entered in the smarthome.target file first and then the according packages must be imported in the MANIFEST.MF. Please have in mind also that for this you would need the repository to be a P2 repository and the library must have a valid OSGi manifest.
2. The processes at Eclipse are pretty restrictive wrt third party dependencies. They aim at protecting us from all sorts of intellectual property related issues. Therefore all used dependencies must first be analyzed and approved explicitly. In the end, they must be served from a repository hosted at Eclipse, AFAIK.
For the above reasons the most pragmatic approach really is to include the JAR file in the sources as you have seen in many other bindings. The point with the IP approval of course remains valid, but that's nothing you need to worry about. This will be done as part of the pull request review.
|
|
|
Powered by
FUDForum. Page generated in 0.06684 seconds