Eclipse 2018-12 has dependency to Windows, Linux and MaxOS - eclipse-plugin

I just updated my application's org.eclipse.e4.rcp feature from Eclipse 4.9. to 4.10 (or 2012-09 to 2012-12). Now I get the exception:
[ERROR] Cannot resolve target definition:
[ERROR] Problems resolving provisioning plan.:
[ERROR] Unable to satisfy dependency from org.eclipse.swt 3.109.0.v20181204-1801 to org.eclipse.equinox.p2.iu; org.eclipse.swt.gtk.linux.x86_64 [3.109.0.v20181204-1801,3.109.0.v20181204-1801].
[ERROR] Unable to satisfy dependency from org.eclipse.swt 3.109.0.v20181204-1801 to org.eclipse.equinox.p2.iu; org.eclipse.swt.cocoa.macosx.x86_64 [3.109.0.v20181204-1801,3.109.0.v20181204-1801].
[ERROR] Unable to satisfy dependency from org.eclipse.swt 3.109.0.v20181204-1801 to org.eclipse.equinox.p2.iu; org.eclipse.swt.gtk.linux.ppc64le [3.109.0.v20181204-1801,3.109.0.v20181204-1801].
Both the .target file and the pom.xml have defined the target platform as being for Windows only:
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
And the target file has additionally includeAllPlatforms="false". If I set it to true, I get the very similar exception:
[ERROR] Software being installed: org.acme.plugin 7.0.0.qualifier
[ERROR] Missing requirement: org.eclipse.swt 3.109.0.v20181204-1801 requires 'org.eclipse.equinox.p2.iu; org.eclipse.swt.gtk.linux.x86_64 [3.109.0.v20181204-1801,3.109.0.v20181204-1801]' but it could not be found
[ERROR] Cannot satisfy dependency: org.acme.plugin 7.0.0.qualifier depends on: java.package; org.eclipse.jface.preference 0.0.0
[ERROR] Cannot satisfy dependency: org.eclipse.jface 3.15.0.v20181123-1505 depends on: osgi.bundle; org.eclipse.swt [3.104.0,4.0.0)
If I add the fragments to the target platform, I get the following message (which is completely understandable):
org.eclipse.swt.gtk.linux.x86_64 3.109.0.v20181204-1801 cannot be installed in this environment because its filter is not applicable. -> [Help 1]
Setting the target platform to planner mode doesn't work. Neither does setting <org.eclipse.swt.buildtime>true</org.eclipse.swt.buildtime> in the pom.xml (false doesn't work either).
Looking at the XML file of the feature I can't see anything wrong with it (the fragments are defined for their OS only), still the target platform wants to haven the fragments for Linux and MacOS, even though I'm on Windows.
The target platform looks like this (yet again, it works if I replace 2018-12 with 2018-09):
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/2018-12/"/>
<unit id="org.eclipse.e4.rcp.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.common.feature.group" version="0.0.0" />
<unit id="org.eclipse.emf.ecore.feature.group" version="0.0.0" />
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0" />
<unit id="org.eclipse.rcp.feature.group" version="0.0.0" />
</location>
And it's hooked in the pom.xml like this:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<resolver>p2</resolver>
<target>
<artifact>
<groupId>groupId</groupId>
<artifactId>org.acme.plugin.build</artifactId>
<version>7.0.0-SNAPSHOT</version>
<classifier>platform</classifier>
</artifact>
</target>
<ignoreTychoRepositories>true</ignoreTychoRepositories>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
What is the problem? How can I fix it?

Who would have thought? It's the exact same Eclipse bug as in this question again. For some reason our build process gives preference to the plug-ins in Maven Central over the ones in the Eclipse repository. Since they have broken Maven dependencies, and since Tycho (obviously) still evaluates these dependencies, that breaks the build.
In our case the fix was as easy as moving Maven Central down below the Eclipse repo in our target platform.

Related

Compiling only part of java classess to java script with GWT using module source path

Guys I am trying to filter out some java files to not be compiled to java script. I cant make it work. I've check documentation here:
https://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml
<source path="_path_" /> : Each occurrence of the tag adds a package to the source path by combining the package in which the module XML is found with the specified path to a subpackage. Any Java source file appearing in this subpackage or any of its subpackages is assumed to be translatable. The element supports pattern-based filtering to allow fine-grained control over which resources get copied into the output directory during a GWT compile.
If no element is defined in a module XML file, the client subpackage is implicitly added to the source path as if had been found in the XML. This default helps keep module XML compact for standard project layouts.
but still no success.
My module file: model.gwt.xml
located in: com.company.section.app.model
with content:
<module>
<source path="">
</source>
</module>
takes all java files from package:
com.company.section.app.model
And I would like to compile only few of them, from f.e.: package com.company.section.app.model.to.javascript
So I do change my module file content into:
<module>
<source path="to.javascript">
</source>
</module>
But I am getting errors, f.e.:
[INFO] [ERROR] Line 69: No source code is available for type
com.company.section.app.model.to.javascript.DeviceDTO; did you forget to
inherit a required module?
I've tried already many combinations like:
<source path="com.company.section.app.model.to.javascript.*">
<source path="to.javascript.*">
<source path=".to.javascript.*">
Some times I am getting error:
[INFO] #
[INFO] # A fatal error has been detected by the Java Runtime Environment:
[INFO] #
[INFO] # SIGSEGV (0xb) at pc=0x00007f09897b3986, pid=1626892, tid=1626899
[INFO] #
[INFO] # JRE version: OpenJDK Runtime Environment (17.0.1+12) (build 17.0.1+12-Ubuntu-121.04)
[INFO] # Java VM: OpenJDK 64-Bit Server VM (17.0.1+12-Ubuntu-121.04, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
[INFO] # Problematic frame:
[INFO] # V [libjvm.so+0x6db986]
[INFO] #
I added source plugin to the project I wanna import (model)
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
I also add source dependency to project
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>shared</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
I can't find any good example of such usage. Do I miss some * asterix? I just dont get it.
Documentation stands that I should add part of package to path, or I miss understood.
Please help.
I hope I did explain it well enough.
I found solution, or my mistake.
In xml module file we need to put path, and not package, like I was doing, so replacing:
<source path="to.javascript">
with
<source path="to/javascript">
Do the job

Feature For Multiple OS

I want to create a feature for the basic Eclipse platform used to create our applications, but for multiple operating systems.
Since the feature.xml seems to support it, I thought as was easy as doing something like this:
<plugin
id="org.eclipse.swt"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.swt.win32.win32.x86"
os="win32"
ws="win32"
arch="x86"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="org.eclipse.swt.win32.win32.x86_64"
os="win32"
ws="win32"
arch="x86_64"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
...adding the plug-ins into a target platform and building it using Tycho. However I get the following exception:
[ERROR] Cannot resolve target definition:
[ERROR] Problems resolving provisioning plan.:
[ERROR] org.eclipse.swt.win32.win32.x86_64 3.7.2.v3740f cannot be installed in this environment because its filter is not applicable.
[ERROR]
[ERROR] Failed to resolve target definition C:\workspaces\MyGreatWorkspace\org.acme.platform.feature\build.target: See log for details: org.eclipse.swt.win32.win32.x86_64 3.7.2.v3740f cannot be installed in this environment because its filter is not applicable. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Neither the target platform definition nor the pom.xml have defined the environment tag, so I'm not even sure what Tycho is validating against.
Having the environment tag doesn't change the exception either:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<!-- [SNIP] -->
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
How do I create a feature for multiple operating systems?

How to build Eclipse plugin project with dependency on Eclipse Birt?

I have a set of Maven projects that I would like to migrate to SBT.
Tne only thing stopping me to do so, it's a project that is an Eclipse plugin, that has dependencies with Eclipse Birt.
The Tycho plugin for Maven, handles all the dependencies. This tool isn't available in SBT. I've found sbt-tycho plugin for SBT, but it looks like unmaintained (3 years with no activity).
Maybe I could build my Eclipse plugin with Maven, and the rest of projects with SBT. But don't know if this is possible.
Other alternative is to use Gradle, by means of the wuff plugin.
Related questions in StackOverflow:
How to build an eclipse plugin with sbt and sbt-osgi?
Can Apache Ivy handle dependencies in p2 repositories?
But I prefer SBT before Maven or Gradle, in order not to introduce yet another language besides Scala.
Is it possible to have all projects in SBT except the one that uses Tycho (Eclipse plugin)?. The Eclipse plugin project is a dependency of the main project, and it rarely changes.
Any ideas?
Update 1: additional information. Eclipse plugins use the p2 repository format for handling dependencies, instead of the standard Maven repository used for Gradle, Maven, Ivy and SBT. That's why special tools are needed. My custom Eclipse plugin has over 100 indirect p2 dependencies.
Update 2
pom.xml of my Eclipse plugin:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>myCompany</groupId>
<artifactId>myPlugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<tycho.version>0.19.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>eclipse</id>
<url>http://download.eclipse.org/releases/kepler</url>
<layout>p2</layout>
</repository>
<repository>
<id>babel</id>
<url>http://download.eclipse.org/technology/babel/update-site/R0.11.1/kepler</url>
<layout>p2</layout>
</repository>
<repository>
<id>logback</id>
<url>http://logback.qos.ch/p2/</url>
<layout>p2</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<resolver>p2</resolver>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
</project>
It appears that the support for Eclipse updatesite with OSGi bundles is already available in Ivy. It doesn't however mean that the resolver can be used directly in sbt (I have never read about it and seen it in use before so I might be mistaken).
There's a way to include any resolver of Ivy in sbt using externalIvySettings():
create the configuration files as you would for Maven (pom.xml) or Ivy
(ivy.xml and optionally ivysettings.xml). External configuration is
selected by using one of the following expressions.
There's Ivy settings (resolver configuration) with externalIvySettings and Ivy file (dependency configuration) with externalIvyFile.
My guess is that you might be quite successful leveraging the support. Just add externalIvySettings and/or externalIvyFile to build.sbt, and create ivy.xml in the top-level directory of the Eclipse plugin's project with a declaration of Ivy's Eclipse updatesite resolver.
You may want to explore the support with the following build.sbt:
externalIvySettings()
libraryDependencies += "bundle" % "org.eclipse.swt.cocoa.macosx.x86_64" % "3.100.1.v4234e"
Place ivysettings.xml in the project's top-level directory (alongside build.sbt):
<ivysettings>
<settings defaultResolver="chain"/>
<resolvers>
<chain name="chain">
<ibiblio name="central" m2compatible="true"/>
<updatesite name="eclipse-juno" url="http://download.eclipse.org/releases/juno" />
</chain>
</resolvers>
</ivysettings>
With the two files above I could update up to failing on some packages:
> update
[info] Updating {file:/Users/jacek/sandbox/eclipse-p2/}eclipse-p2...
:: loading settings :: file = /Users/jacek/sandbox/eclipse-p2/ivysettings.xml
[warn] module not found: package#org.eclipse.swt.accessibility2;[0.0.0,)
[warn] ==== central: tried
[warn] http://repo1.maven.org/maven2/package/org.eclipse.swt.accessibility2/[revision]/org.eclipse.swt.accessibility2-[revision].pom
[warn] -- artifact package#org.eclipse.swt.accessibility2;[0.0.0,)!org.eclipse.swt.accessibility2.jar:
[warn] http://repo1.maven.org/maven2/package/org.eclipse.swt.accessibility2/[revision]/org.eclipse.swt.accessibility2-[revision].jar
[warn] ==== eclipse-juno: tried
[warn] module not found: package#org.mozilla.xpcom;[0.0.0,)
[warn] ==== central: tried
[warn] http://repo1.maven.org/maven2/package/org.mozilla.xpcom/[revision]/org.mozilla.xpcom-[revision].pom
[warn] -- artifact package#org.mozilla.xpcom;[0.0.0,)!org.mozilla.xpcom.jar:
[warn] http://repo1.maven.org/maven2/package/org.mozilla.xpcom/[revision]/org.mozilla.xpcom-[revision].jar
[warn] ==== eclipse-juno: tried
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: package#org.eclipse.swt.accessibility2;[0.0.0,): not found
[warn] :: package#org.mozilla.xpcom;[0.0.0,): not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] package:org.eclipse.swt.accessibility2:[0.0.0,)
[warn] +- bundle:org.eclipse.swt:[3.0.0,4.0.0)
[warn] +- bundle:org.eclipse.swt.cocoa.macosx.x86_64:3.100.1.v4234e (/Users/jacek/sandbox/eclipse-p2/build.sbt#L3-4)
[warn] +- default:eclipse-p2_2.10:0.1-SNAPSHOT
[warn] package:org.mozilla.xpcom:[0.0.0,)
[warn] +- bundle:org.eclipse.swt:[3.0.0,4.0.0)
[warn] +- bundle:org.eclipse.swt.cocoa.macosx.x86_64:3.100.1.v4234e (/Users/jacek/sandbox/eclipse-p2/build.sbt#L3-4)
[warn] +- default:eclipse-p2_2.10:0.1-SNAPSHOT
Another solution (I haven't tried yet) is to use the sbt-osgi-manager plugin, designed for this purpose. It is actively mantained.
I'll update this answer with my experiences.
UPDATE: it doesn't work for me in the first try.
The final solution is to use a standard Maven repository for the Birt plugins. This solution is good for the embedding the Birt runtime, but not for a complete RCP app.

How to Use JGit in Eclipse Plugin Project

I am creating an Eclipse plug-in that requires the use of JGit. However, I am not sure how to import the bundle as a dependency.
When I try to build with tycho I am greeted with errors about being unable to resolve the dependency. I have tried adding a dependency in the pom:
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>3.2.0.201312181205-r</version>
</dependency>
Adding the bundle to Required-Bundles in the manifest:
But all efforts lead back to being unable to resolve the dependency:
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from com.inin.testing.eclipse.plugin.submit 0.5.0.qualifier to bundle org.eclipse.jgit 3.2.0.; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.0.v_OTDT_r220_201306071800 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; Unable to satisfy dependency from org.eclipse.jdt.core 3.9.1.v_OTDT_r221_201309101918 to org.eclipse.objectteams.otdt.core.patch.feature.group [2.0.0,3.0.0).; No solution found because the problem is unsatisfiable.]
If anyone has had success using the JGit library in an eclipse plug-in project let me know how you are consuming it.
If you are working with PDE, JGit (or other dependencies) is best consumed through a Target Platform.
The definition below integrates JGit 3.2 from the projects' software repository at Eclipse.org.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="JGit" sequenceNumber="53">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jgit.feature.group" version="3.2.0.201312181205-r"/>
<unit id="org.eclipse.jgit.source.feature.group" version="3.2.0.201312181205-r"/>
<repository location="http://download.eclipse.org/egit/updates"/>
</location>
</locations>
</target>
Paste the snippet into a file within your workspace and open it with the (default) Target Definition Editor. Select the 'Set as Target Platform' link in the top-right corner. This will download JGit along with required bundles and make them your current target platform.

How can i force intellij + ivy to download what i want it to?

Uinsg IntelliJ, currently ivy gives me this error message:
:: downloading artifacts ::
[NOT REQUIRED] folder#scopt;2.10-3.1.0!scopt.jar
When I try to use our firm-internal ivy system.
I can see that the jar file is in the correct location that the resolver points to, and the ivy cache (using IntelliJ) is clean.
Ivy otherwise will download files requested.
The issue is with IntelliJ, eclipse can find and download the jar with the same ivy.xml and ivy.settings file without any issue
This is not a duplicate as suggested - if i change my internal IntelliJ settings to exclude jar files then i get an error at the bottom of the output (stating that jar files are not to be downloaded). I currently have the logging as "All" in intelliJ)
~~~~~
The ivy resolver code is:
<resolvers>
<filesystem name="secret-source-resolver" checkmodified="true" checkconsistency="false">
<artifact pattern="//a/b/c/d/[organisation]/e/f/[module]/[artifact]_[revision].[ext]" />
</filesystem>
</resolvers>
<modules>
<module organisation="theOrg" name="scopt" resolver="secret-source-resolver" />
</modules>
And the ivy.xml file is
<dependencies>
<dependency org="theOrg" name="scopt" rev="2.10-3.1.0">
<artifact name="scopt" type="jar" force="true" conf="runtime" />
</dependency>
</dependencies>
Looking at the folder that i'm getting the files from, the jar files are present.
Finally, in the output:
don't use cache for theOrg#scopt;2.10-3.1.0: checkModified=true
trying //v/campus/ny/cs/theOrg/shared/apps/scopt/scopt_2.10-3.1.0.jar
tried //v/campus/ny/cs/theOrg/shared/apps/scopt/scopt_2.10-3.1.0.jar
secret-source-resolver: no ivy file found for theOrg#scopt;2.10-3.1.0: using default data
checking theOrg#scopt;2.10-3.1.0[default] from secret-source-resolver against [none]
module revision kept as first found: theOrg#scopt;2.10-3.1.0[default] from secret-source-resolver
found theOrg#scopt;2.10-3.1.0 in secret-source-resolver
would indicate that ivy can find it, it just felt that downloading would be... bad?
I am currently using intelliJ 12.0 (company thing, v. hard to upgrade)
Any ideas?
No solution unfortunately, but we are seeing the same thing. It does not appear to be consistent however, it works as expected on some developers machines but fails with this error on others.