missing maven dependencies in RCP product using tycho - eclipse-plugin

I'm using tycho for creating a RCP product but as soon as I set the plugin pom
packaging to eclipse-plugin ,maven dependency library removes from project and cause lots of error because of missing library.I've tried running maven both on terminal and eclipse and they have the same result.Does anyone know how to fix this problem and is there someone that exported a complete RCP plugin using tycho?
thank you.

Tycho does not use maven dependencies to compile your plugin. Dependencies are specified using the plugin Manifest file as with a normal eclipse plugin.
In Eclipse, dependencies will be found using the workspace (assuming m2e & tycho configurators are installed) or from the plugins defined in your target platform (typically the eclipse installation). On the command line, these dependencies should be available in a p2 repository - these can be defined in a target definition file or in a normal maven repository block in the pom file with the p2 layout. See [1] for details on using these.
It is possible to configure Tycho to consider pom dependencies but this will not work when exporting an RCP application - dependencies need to be found in a p2 repository.
[1] http://wiki.eclipse.org/Tycho/Reference_Card#Repository_providing_the_context_of_the_build

Related

Intellij IDEA With Multiple Gradle Projects

I am working on two Gradle projects. One of these projects is a supporting library that will be used by other projects in the future so project A depends on project B but not as a 'multi module project'. The dependency is to be resolved through the artifact repo so project a declares it as a compile dependency using it's maven coordinates.
My problem is when working on these two projects in IntelliJ changes to project B aren't made available to project A until I install it (using the Gradle Maven plugin) in my local repo. This is kind of annoying and slows down my workflow. Is there a way to get IntelliJ to automatically update the dependency internally?
This is supported in the latest versions of Gradle and IntelliJ. It is known as a Composite Build.
Composite builds can be declared in the project's settings.gradle file as follows:
includeBuild '../my-app'
or by using the --include-build command line argument:
$ gradle --include-build ../my-utils run
Take a look at the Composite Builds with Gradle and IntelliJ IDEA Webinar for instructions on how to configure the integration.
In IDEA 2017 you can right-click on the gradle module and use Composite Build Configuration to link the current module to one or more gradle module already opened in the current workspace.

How to put Maven Tycho Dependency in my Eclipse Plug-in?

I've created a new project using tycho 0.26.0, it runs with Eclipse 4 Neon.2, so all modules are building successfully using maven, now I am trying to add a new dependency in my project, I have created a jar and I want to use it in my project, but I don't understand so good how is it working.
I add I am using a target definition, so I have to add my configuration to this file, this will be used by my modules.
I don't know if I got your question right.
I assume you want to build an Eclipse RCP application with tycho and use an JAR file from one of your plug-ins.
The simplest solution is then to create a new plug-in project from this jar by using the Plug-in from existing JAR Archives-Wizard.
If you have done this, you can add a dependency from this new plug-in to your existing plug-ins. Don't forget to export all packages of the library, by opening Manifest.mf and adding all packages in the Runtime tab.
To get this running with maven you have also to add a pom.xml file to the new Plug-in. This link help me a lot with maven tycho (http://codeandme.blogspot.de/p/tycho-articles.html).
Btw. if you don't need this library as plain JAR, you can also create directly a Plug-in project instead of first creating a JAR and then creating a Plug-in project.

How to find the artifacts that depend on another artifact?

We are using Maven to build our projects and Nexus as repository manager.
Is there a way to know where an artifact is a dependency of another artifact?
For example, we want to know which of the artifacts in our Release repository have a dependency on commons-io 1.2, or version x.y of our framework2, or ...
mvn dependency:tree should help you get this info.
Have you looked at the Maven Site plugin in conjunction with the dependencies and dependencies-convergence report from the Maven Project Info Reports plugin?
This will generate an html report that shows all the artifacts that the project uses and what other artifacts that are dependent on that artifact.
The Maven client will only tell you the dependencies of a single project. I'd recommend using Sonar as part of your build process. It's primarily used for source code analysis, but it will also report usage of a particular library by other projects in the same Sonar database.

Different maven versions cause extra libraries to be included in WAR file

I'm trying to build a war file to be deployed to a tomcat server using Maven, but have noticed some strange behaviour when building my war file:
When running the command from project folder: mvn clean compile package -DskipTests
Maven version 3.0 produces a war file
12.079MB (49 jar files in WEB-INF/lib folder)
Maven version 3.0 beta1
produces a war file 8.7MB (31 jar
files in WEB-INF/lib folder)
Maven version 2.11 produces a war file 2.3MB (3 jar files in WEB-INF/lib folder)
What can be causing the extra jar files to be included in the project? Presumably they are not needed as building the project using version 2.11 has worked fine in the past.
I had something similar happen to me. Here's what happened.
In Maven 2.x the plugin versions are set by Maven itself. In Maven 3.x it will use the "latest" and give you a warning. In my case, using a later version of the compiler plugin caused some differences and a later version of the dependency plugin cause other differences.
Once I explicitly set all the versions of all plugins in my pom.xml (a best practice anyway), the inconsistencies went away.

Link Maven OSGi to Maven NetBeans Platform Project

I am using NetBeans 6.9 Beta and I would like to accomplish the following:
Set up a project representing the main application using Maven (for instance "Maven Project", "Maven NetBeans Application")
Ideally, the project should only contain the necessary libraries to run in Apache Felix (I would like to be able to right-click the project and select "Run in Felix")
I do not want that the project contains all the NetBean Platform APIs
I would prefer to implement the modules using OSGi. For instance "Maven OSGi Bundle", "Maven NetBeans Module" + OSGi
These are the problems, which I have at the moment:
The standard Maven archetype ("Maven NetBeans Application") seems always to select all APIs and I have not found a way to deselect APIs - in normal NetBeans Platform Applications that can be accomplished by going to the project properties and deselected the platform modules) - I guess it has something to do with the NetBeans repository (http://bits.netbeans.org/maven2)? Do I have to create another repository?
When creating normal "NetBeans Module" with OSGi support, the modules contain both NetBeans Module and OSGi meta data, which is nice. So, for instance the tool support in NetBeans is available for both technologies. But the "Maven NetBeans Modules" have only NetBeans meta data and the Maven OSGi Bundles have only OSGi meta data).
3. I figured out how to add modules to the project by using project / new and then placing the modules in the Maven project folder. However, I do not quite know yet how I could link to modules from other locations (NetBeans uses Maven modules, which have to be in the same directory as the project?).
Below some useful links for Maven + OSGi in NetBeans
wiki.netbeans.org/STS_69_Maven_OSGI NetBeans Maven OSGi Test Specification
platform.netbeans.org/tutorials/nbm-maven-quickstart.html NetBeans Platform Quick Start Using Maven (6.9)
wiki.netbeans.org/MavenBestPractices NetBeans Maven BestPractices
maven.apache.org/pom.html#Aggregation Maven Documentation Multi-Module Projects
(sorry about the missing protocol but couldn't post the message otherwise)
your nbm-application project depends on all platform projects.. just use the regular maven dependency management (adding/removing dependencies, adding dependency excludes to limit your platform
configure the nbm plugin and the bundle plugin yourself to sequentially append content to the manifest file.. I think Fabrizio Guidici's forceten and bluemarine projects do that in some way..
I don't understand the problem entirely. maven modules are a different thing than netbeans modules. you can for sure compose the application from multiple independently build nb module artifacts.