Eclipse EMF RAP Target Components - eclipse

Good day all,
I am attempting to get an Eclipse RAP application running with EMF support. Following the steps from the Eclipse wiki (https://wiki.eclipse.org/RAP/EMF_Integration) as closely as possible (it's dated four years ago), I am putting the following packages into my Target definition:
EMF RAP Target Components
RAP Basic Equinox Target
RAP Runtime
This gives me the following Target definition:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="SCRAMSTargetDefinition" sequenceNumber="17">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.rap.sdk.feature.group" version="2.13.0.v20170609-0928"/>
<unit id="org.eclipse.rap.equinox.target.feature.feature.group" version="3.2.0.20170613-1148"/>
<unit id="org.eclipse.rap.feature.feature.group" version="3.2.0.20170609-1144"/>
<repository location="http://download.eclipse.org/releases/oxygen/"/>
</location>
</locations>
</target>
The Target will not resolve though, giving me the following dependency errors:
Problems occurred while resolving the target contents
Cannot complete the install because one or more required items could not be found.
Cannot satisfy dependency:
From: EMF RAP Runtime 2.13.0.v20170609-0928 (org.eclipse.emf.rap.feature.group 2.13.0.v20170609-0928)
To: org.eclipse.emf.rap.edit.ui.feature.group [2.9.0.v20170609-0928]
Cannot satisfy dependency:
From: EMF RAP Target Components 2.13.0.v20170609-0928 (org.eclipse.emf.rap.sdk.feature.group 2.13.v20170609-0928)
To: org.eclipse.emf.rap.feature.group [2.13.0.v20170609-0928]
Missing requirement: EMF RAP Edit UI 2.9.0.v20170609-0928 (org.eclipse.emf.rap.edit.ui.feature.group 2.9.0.v20170609-0928) requires 'A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0' but it could not be found
Software being installed: EMF RAP Target Components 2.13.0.v20170609-0928 (org.eclipse.emf.rap.sdk.feature.group 2.13.0.v20170609-0928)
Buried in there is A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0, which would seem to be the core problem - but this is a Target Definition, not the IDE itself, so I'm not understanding why it's complaining in this way.
I have tried including combinations of other EMF packages into the Target Definition, but nothing has helped. Any guidance would be appreciated.

I found the answer in the Eclipse Forums:
When adding the update site to the target definition, the Include required software option has to be disabled. This is equivalent to switching includeMode from planner to slicer. In addition to that, you might want to enable the Include all environments option (set includeAllPlatforms to true).
Please note that these settings have to be the same for all locations (if the target definition includes more than one location / update site).

Related

Trying to add javax.xml.soap to RCP when upgrading to Java 11

I want to prepare my RCP app for Java 11. As the app makes SOAP calls, I need to provide the javax.xml.soap packages in my build. What is the best way to do this?
All calls are done inside one plugin so I did wonder whether to just fetch the jars I need and put them inside that plugin. But wouldn't it be better add these items to the target definition and make it part of the platform?
After some searching I found MOXy the EclipseLink project which seems to be what I need. I tried to add this to my target definition but got errors:
${eclipse_home} 1212 plug-ins available
https://download.eclipse.org/rt/eclipselink/updates/
Problems occurred while resolving the target contents
Cannot complete the install because one or more required items could not be found.
Cannot satisfy dependency:
From: EclipseLink MOXy 2.7.7.v20200504-69f2c2b80d (org.eclipse.persistence.moxy.feature.group 2.7.7.v20200504-69f2c2b80d)
To: org.eclipse.equinox.p2.iu; com.sun.mail.jakarta.mail [1.6.4,1.6.4]
Missing requirement: Jakarta Mail API 1.6.4 (com.sun.mail.jakarta.mail 1.6.4) requires 'java.package; javax.crypto 0.0.0' but it could not be found
Software being installed: EclipseLink MOXy 2.7.7.v20200504-69f2c2b80d (org.eclipse.persistence.moxy.feature.group 2.7.7.v20200504-69f2c2b80d)
I am a bit confused as I thought these install-projects pull in dependencies as required. Is that wrong? How do I fix these errors?
You can add javax.xml.soap from an Eclipse repository. For example insert this into your target definition between the tags
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="javax.xml.soap" version="1.2.0.v201005080501"/>
<repository location="http://download.eclipse.org/releases/2020-12"/>
</location>
Here https://download.eclipse.org/oomph/archive/reports/download.eclipse.org/releases/2020-12/index.html you can explore the repository, on the bottom expand the Installable Units, and there is a filter. If you need anything else from this repository, you only need a new line with unit id and version.
If javax.xml.soap depends on some other installable unit, you should be able to find it in this repository.

Multiple-artifact resolution with Ivy

I need to resolve a jcuda native library via Ivy, but I'm having some trouble finding the right way to define the dependency.
I'm using Artifactory for my dependency management, and it properly identified and resolved the individual native library versions for all available plaforms (see screenshot):
However, I am stuck at the resolution of the
The error produced by Ivy shows the correct resolution path.
I found a hint in the original Maven definition for these libraries (found in my local Ivy cache, %HOME%\.ivy2\cache\org.jcuda\jcuda-natives\windows-x86_64\ivy-0.8.0.xml.original), which used the following classifier:
<classifier>${jcuda.os}-${jcuda.arch}</classifier>
In my Ivy configurations, I don't distinguish OS and architecture, but using the catenated classifier gives me windows-x86_64, which is the jar file I'm looking for.
I needed to add the Maven namespace (xmlns:maven="http://maven.apache.org") to ivy.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" xmlns:maven="http://maven.apache.org">
And then the following dependency can use maven:classifier to resolve the specific native library I'm looking for:
<dependency org="org.jcuda" name="jcuda-natives" rev="0.8.0">
<artifact maven:classifier="windows-x86_64" ext="jar" />
</dependency>

Eclipse/Grails - Tests don't run - ClassNotFoundException [duplicate]

While running junit test in eclipse I am getting this Exception:
java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
I've added junit.jar library file.
I've tried different versions of junit.jar: 4.4, 4.8, etc.
How do I fix this Exception?
Add hamcrest-all-X.X.jar to your classpath.
Latest version as of Feb 2015 is 1.3:
http://code.google.com/p/hamcrest/downloads/detail?name=hamcrest-all-1.3.jar&can=2&q=
According to the JUnit GitHub team website (https://github.com/junit-team/junit/wiki/Download-and-Install), junit.jar and hamcrest-core.jar are both needed in the classpath when using JUnit 4.11.
Here is the Maven dependency block for including junit and hamcrest.
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1.2</version>
<scope>test</scope>
</dependency>
<!-- Needed by junit -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
A few steps you have to follow:
Right click on the project.
Choose Build Path Then from its menu choose Add Libraries.
Choose JUnit then click Next.
Choose JUnit4 then Finish.
Works for me: IntelliJ IDEA 13.1.1, JUnit4, Java 6
I changed the file in project path: [PROJECT_NAME].iml
Replaced:
<library>
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
By:
<library name="JUnit4">
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.11.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
So the final .iml file is:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="JUnit4">
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.11.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
P.S.: save the file and don't let to IntelliJ Idea reload it. Just once.
You need junit-dep.jar because the junit.jar has a copy of old Hamcrest classes.
Just in case there's anyone here using netbeans and has the same problem, all you have to do is
Right click on TestLibraries
Click on Add Library
Select JUnit and click add library
Repeat the process but this time click on Hamcrest and the click add library
This should solve the problem
This problem is because of your classpath miss hamcrest-core-1.3.jar. To resolve this add hamcrest-core-1.3.jar as you add junit-4.XX.jar into your classpath.
At first, I encounter this problem too, but after I refer to the official site and add hamcrest-core-1.3.jar into classpath with command line, it works properly finally.
javac -d ../../../../bin/ -cp ~/libs/junit-4.12.jar:/home/limxtop/projects/algorithms/bin MaxHeapTest.java
java -cp ../../../../bin/:/home/limxtop/libs/junit-4.12.jar:/home/limxtop/libs/hamcrest-core-1.3.jar org.junit.runner.JUnitCore com.limxtop.heap.MaxHeapTest
You need to add the hamcrest-core JAR to the classpath as described here: https://github.com/junit-team/junit4/wiki/Download-and-Install
As a general rule, always make sure hamcrest is before any other testing libraries on the classpath, as many such libraries include hamcrest classes and may therefore conflict with the hamcrest version you're using. This will resolve most problems of the type you're describing.
the simplest way of solving the problem to begin with is copying latest version of hamcrest-code.jar into your CLASSPATH that is the file you store other .jar files needed for compilation and running of your application.
that could be e.g.: C:/ant/lib
It sounds like a classpath issue, so there are a few different ways to go about it. Where does org/hamcret/SelfDescribing come from? Is that your class or in a different jar?
Try going to your project Build Path and on the Libraries tab, add a Library. You should be able to choose JUnit to your project. This is a little bit different than just having the JUnit jar file In your project.
In your Run Configuration for the JUnit test, check the Classpath. You could probably fix this by adding making sure your Classpath can see that SelfDescribing class there. The Run option in Eclipse has a different set of options for the JUnit options.
If this problem arise in a RCP project it can be because JUnit has been explicitly imported.
Check the editor for your plugin.xml under Dependencies tab, remove the org.junit from the Imported Packages and add org.junit to the Required Plug-ins.
The problem is when you set up eclipse to point to JRE instead of JDK. JRE has junit4.jar in the lib/ext folder, but not hamcrest.jar :) So the solution is to check installed JREs in Eclipse, remove the existing one and create a new one pointing to your JDK.
This happens when you run Ant via command line. The implicit user dependencies are added in the classpath at the end and take precedence over the project-added classpath. Run Ant with -nouserlib flag. The implicit dependencies would be excluded from the classpath.
There is a better answer to solve this problem.
add dependency
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
The hamcrest-core-1.3.jar available on maven repository is deprecated.
Download working hamcrest-core-1.3.jar from official Junit4 github link .
If you want to download from maven repository, use latest hamcrest-XX.jar.
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
I had the same problem, the solution is to add in build path/plugin the jar org.hamcrest.core_1xx, you can find it in eclipse/plugins.
A few steps you have to follow:
Right click on the project.
Choose Build Path & then from its menu choose Add Libraries.
Choose JUnit then click Next.
Choose JUnit4 then Finish.
This works for me...
"java.lang.SecurityException: class" org.hamcrest.Matchers "'s signer information does not match signer information of other classes in the same package"
Do it:
Right-click on your package
click on Build Path -> Configure Build Path
Click on the Libraries tab
Remove JUnit
Apply and close
Ready.
Try adding the jar files manually or try with force update with the latest hamcrest.jar

How to build a feature to a zip file using Tycho

I'm trying to export an Eclipse feature using Tycho, replacing the "Export Wizard" found on the Eclipse overview of the feature. The wizard gives the option for the export destination as a zip file. Is there a way to do the same with Tycho?
In order to build a zip file with the feature and the feature's plug-ins, you need to add a module of the assembly packaging type eclipse-repository to your reactor:
Add an eclipse-repository module with the same parent POM as the
eclipse-feature module (in order to inherit the same target
platform configuration).
Create a category.xml file in the root of the new module with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="todo.your.feature.id" />
</site>
Add the new module to your root POM.

Module dependency has friend dependency on org.netbeans.libs.javacimpl/1but is not listed as friend

I am developing some application on NetBeans Platform 6.9.1 with Maven. I have Netbeans Platform Application created from maven artefact. I need to depend on Java Source API, because my application is performing some kind of analysis on the source code of Java projects.
I have followed partially this tutorial: http://platform.netbeans.org/tutorials/60/nbm-copyfqn.html (with the exception, that I tried to do dependency management with Maven).
When I try to satisfy all dependencies (add them to pom.xml), I get this message:
Module dependency has friend dependency on org.netbeans.libs.javacimpl/1but is not listed as friend.
For javacimpl package (it's requested by the application that starts up)... the same error it writes for another two packages...
I have read many discussions in other forums, but none of them gave me clear solution.
Does anyone know?
In your module.xml you have to define an impl dependency
Have a look at the codehause page It would be better if you could use a spec dependency, but I have a feeling you wont be able to.
As an example your module.xml will look like this
<?xml version="1.0" encoding="UTF-8"?>
<nbm>
<licenseName>Apache License, Version 2.0</licenseName>
<licenseFile>license.txt</licenseFile>
<dependencies>
<dependency>
<id>org.netbeans.api:org-netbeans-modules-java-source</id>
<type>impl</type>
<explicitValue>0.60.2.10.8.4</explicitValue>
</dependency>
</dependencies>
</nbm>