Best practice to add a maven dependency to an Eclipse RCP Plugin - maven

I want to add some GitHub projects as dependencies to my Eclipse RCP Plugin. The GitHub projects are oshi and leshan.
Both GitHub projects provide maven builds over maven central which i could use.
But as i understand so far i cant use these builds directly in an Eclipse RCP Plugin because it requires OSGI-Bundles - in contrast to an "classic" Eclipse Java project.
So far i found three ways of dealing with this problem:
let Eclipse convert the JARs to an OSGI-Bundle and add them to a Plugin which i can make a dependency on (described here https://stackoverflow.com/a/3594698/12029492)
look if the GitHub projects are available on Eclipse Orbit and add the p2 Repository to my Target Platform. (described here https://stackoverflow.com/a/56854979/12029492) Sadly on the Orbit site is only the oshi project in an older version than it is on GitHub.
create my own p2 repository with p2-maven-plugin and add it to my Target Platform.
I also looked into Tycho but as far as i understand you can only add a p2 repository as a dependency in Tycho, which leads again to the problem of creating one.
Is there another/better way of dealing with Non-OSGI-Bundle Maven builds in an Eclipse RCP Plugin?
EDIT: i found for me the best way to use gradle (a gradle plugin bnd-platform), to automatically resolve the dependencies using maven central and create a local p2 repository, described in Option 1 here https://stackoverflow.com/a/29509794/12029492

Recently the Eclipse Maven (M2E) implemented tight integration of Java libraries from Maven central into the target platform. With this, you can easily add Java libraries to your target platform and they can be converted (if necessary) on the fly to OSGi bundles including their dependencies.
See https://www.vogella.com/tutorials/EclipseJarToPlugin/article.html for how to using Java libraries (from Maven Central) for OSGi, Eclipse Plug-in and Eclipse RCP development.
This extension is also supported with the latest Maven Tycho version for command line builds, see https://www.vogella.com/tutorials/EclipseTycho/article.html

Related

Is it possible to change dependencies in a maven plugin programmatically?

I am building a maven plugin which I would like to attach to a project which uses the artifact of another project which I'm building.
For instance:
Project A --> Project B
I could run Project A with two different branches of Project B so I would like to checkout and generate the artifact on demand.
Is it possible to access the maven dependencies of the project and remove or add one or trigger another project build?

download a large size project from maven repository

my professor have assigned me to download a large size project from Maven repository and then run it through findbugs to report errors, if any.
I have installed Maven and started creating a simple project but I need to download an existence project in maven so is there any help on how I can download a large project from maven?

Build Process Design: Nuget vs Artifact Dependencies

I have an application A that depends on an internal shared library B. A and B each has their own repositories.
I'm using TeamCity 10 to build these two projects. Two ways I considering doing this:
Build B and publish the dlls as artifacts. Build A with an artifact dependency on B.
Build B and publish as a nuget package. Build A with a nuget dependency on B.
My questions are:
Which approach is better?
Artifact dependencies seem like the simplest approach and can get the job done, but if we go the nuget route, we can generalize dependency resolution and decouple it from the buildserver to do it. Another advantage I can see with nugets is that when developers checkout solution for B, any dependencies can be resolved through nuget. While for artifact dependencies, some type of pre-build script on the developer's local machine is needed to retrieve/copy dll artifacts, mimicking what TeamCity does with artifact dependencies on the buildserver (is there a better approach for this?).
If we implement nuget dependencies, why would we ever need artifact dependencies at all?
Thanks in advance for any feedback offered.
The best approach for this is based on your projects developing progress.
If the project A and Project B are still in developing, I suggest you use artifact dependencies. Since you will change the projects very often when developing them, in TeamCity you just need to add artifact dependencies to the build configurations. No matter how you change the projects code, the build configurations need not to change.
If the projects development has finished, the NuGet dependencies is a good choice. Because if you are using NuGet dependencies when developing the projects, when any code changed during developing, you need to re-pack the packages and reinstall it into your project.
I would prefer to use Nuget just as the advantages you have already mentioned in your question. It's more convenient and can save more time when you want add the shared library to your project/solution to build locally.

Jenkins Artifactory Plugin multi-project release

I have configured jenkins and the artifactory plugin to work and do the release for single project.
I recently created a multi-project, and im not sure how to release so that all dependant projects have the version incremented.
So for instance Project A -> Project B - > Project C
If i release project C from jenkins will this cause an increment in versions for all projects, i really cant be messing around with releases... so have not tested this.
Thanks
maven multi module project.
If the projects are not multi module than i will need update each one individually.

Intellij IDEA cannot resolve dependencies in multimodule project

I decide to try Intellij Idea, and I imported existing Maven multi-module project from Eclipse into Idea. But Idea can't resolve dependencies related with GWT classes and some dependencies between maven modules. I tried to re-import maven projects - it don't help.
How I can solve this problem?
Additional info:
Project was imported from Eclipse's workspace (with eclipse specific files, such as .project etc. But I don't think it can be problem). GWT dependencies are exist in pom.xml, but all classes from GWT highlighted with red color. In eclipse this project work fine.

Resources