What is the match rule of Feature Dependencies? - eclipse

When I set the required features of a feature, I add "test.feature.A" and don't specify its version, why there is an Error icon on this feature? I don't see any error message.
screenshot
test.feature.A :
<?xml version="1.0" encoding="UTF-8"?>
<feature id="test.feature.A" label="A" version="1.0.0.qualifier">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
</feature>
test.feature.B
<?xml version="1.0" encoding="UTF-8"?>
<feature id="test.feature.B" label="B" version="2.0.0.qualifier">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<requires>
<import feature="test.feature.A"/>
</requires>
</feature>
Moreover, if I specify its version and don't specify its Match Rule, what is the actual match rule ?
<requires>
<import feature="test.feature.A" version="1.0.0.qualifier"/>
</requires>

Related

Use .targets to replace file in NuGet package

I have a NuGet package that depends on another NuGet package but I want to replace one of the unmanaged DLLs with one of mine. This works well, but now I'm trying to add support for both x86 and x64 using a .targets file. When my target application builds, it pulls down the original version, not the replacement.
Here's my .nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyPackage</id>
<version>2.0.0</version>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="YourPackage" version="1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="MyPackage.targets" target="build\net452" />
<file src="..\lib\x86\thepackage.dll" target="lib\net452\x86" />
<file src="..\lib\x64\thepackage.dll" target="lib\net452\x64" />
</files>
</package>
Here's my .targets:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PlatformCheck" BeforeTargets="InjectReference"
Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64'))">
<Error Text="$(MSBuildThisFileName) does not work correctly on '$(Platform)' platform. You need to specify platform (x86 or x64)." />
</Target>
<Target Name="InjectReference" AfterTargets="ResolveAssemblyReferences">
<ItemGroup Condition="'$(Platform)' == 'x86' or '$(Platform)' == 'x64'">
<Reference Include="MyPackage">
<HintPath>$(MSBuildThisFileDirectory)$(Platform)\thepackage.dll</HintPath>
</Reference>
</ItemGroup>
</Target>
</Project>
What am I doing wrong?
EDIT: If I change the .nuspec...
<file src="..\lib\x86\thepackage.dll" target="lib\net452" />
<file src="..\lib\x64\thepackage.dll" target="lib\net452" />
... then it pulls down my version but uses x86 for both x86 and x64 builds.
I solved it by putting the files in the build folder and then simply copying the target file.
.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyPackage</id>
<version>2.0.0</version>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="YourPackage" version="1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="MyPackage.targets" target="build\net452" />
<file src="..\lib\x86\thepackage.dll" target="build\net452\x86" />
<file src="..\lib\x64\thepackage.dll" target="build\net452\x64" />
</files>
</package>
.targets:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PlatformCheck" BeforeTargets="InjectReference"
Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64'))">
<Error Text="$(MSBuildThisFileName) does not work correctly on '$(Platform)' platform. You need to specify platform (x86 or x64)." />
</Target>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)$(Platform)\thepackage.dll">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

How to make a Eclipse plug-in deployable in many Eclipse versions?

I wrote my own Eclipse plug-in for Eclipse Oxygen 3a. It works perfectly in Eclipse Oxygen 3a.
Now I'm being required to deploy the same plug-in in newer versions of Eclipse, but when the plug-in is being installed in, for instance, Eclipse Photon, the install window says:
Cannot perform operation. Computing alternate solutions, may take a while: ...
It indeed takes a long while and ends up saying that my plug-in will not be installed.
What to do to make this plug-in workable to more than one Eclipse version?
Update 1
As asked, this is the Require-Bundle:
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui.editors,
org.eclipse.ui.views;bundle-version="3.8.0",
org.eclipse.ui.ide,
org.eclipse.jdt.ui;bundle-version="3.13.52",
org.eclipse.jdt.core;bundle-version="3.13.50"
There is no Import-Bundle.
Update 2
The feature.xml file can be seen below. I have a plug-in site deployed in an internal Apache web server and use "Install new software" option in Help menu of Eclipse to install from thare.
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="MyPluginFeature"
label="MyPlugin"
version="0.4.0"
provider-name="MyPlugin.com"
plugin="MyPlugin">
<description url="http://www.example.com/description">
</description>
<copyright url="http://www.example.com/copyright">
</copyright>
<license url="http://www.example.com/license">
</license>
<url>
<update label="MyPlugin site" url="http://acme.com/myplugin"/>
</url>
<requires>
<import plugin="org.eclipse.core.expressions" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.3.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.core.resources" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.13.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.7.0" match="compatible"/>
<import plugin="org.eclipse.text" version="3.6.0" match="compatible"/>
<import plugin="org.eclipse.osgi" version="3.7.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.core.jobs" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.preferences" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.core.contenttype" version="3.3.0" match="compatible"/>
<import plugin="org.eclipse.equinox.app" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.equinox.common" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.osgi" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.commands" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.swt" version="3.103.0" match="compatible"/>
<import plugin="org.eclipse.jface" version="3.13.0" match="compatible"/>
<import plugin="org.eclipse.ui.workbench" version="3.105.0" match="compatible"/>
<import plugin="org.eclipse.core.expressions" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.swt" version="3.104.0" match="compatible"/>
<import plugin="org.eclipse.core.commands" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.3.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.compare.core" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.expressions" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.jface.text" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.ui" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.11.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.2.0" match="compatible"/>
<import plugin="org.eclipse.core.filebuffers" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.resources" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.text" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.ltk.core.refactoring" version="3.7.0" match="compatible"/>
<import plugin="org.eclipse.jface.text" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.ui.navigator" version="3.3.200" match="compatible"/>
<import plugin="org.eclipse.compare" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.team.core" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.team.ui" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.ui.views" version="3.8.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.jdt.ui" version="3.13.52" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.core" version="3.13.50" match="greaterOrEqual"/>
</requires>
<plugin
id="org.eclipse.core.resources"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.filesystem"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.text"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.common"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jface"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui.workbench.texteditor"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ltk.core.refactoring"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ltk.ui.refactoring"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="MetaCoder"
download-size="0"
install-size="0"
version="0.4.0"
unpack="false"/>
</feature>
Update 3
Remediation window:
Update 4
After the unsuccessful atempt to install the plug-in in Eclipse JEE 2019-Jul I had the following error message:
Cannot complete the install because of a conflicting dependency.
Software being installed: MyPlugin 0.4.0 (MyPluginFeature.feature.group 0.4.0)
Software currently installed: Eclipse Platform 4.13.0.v20190916-1323 (org.eclipse.platform.feature.group 4.13.0.v20190916-1323)
Only one of the following can be installed at once:
Core File Systems 1.7.500.v20190620-1312 (org.eclipse.core.filesystem 1.7.500.v20190620-1312)
Core File Systems 1.7.0.v20170406-1337 (org.eclipse.core.filesystem 1.7.0.v20170406-1337)
Core File Systems 1.7.400.v20190518-1151 (org.eclipse.core.filesystem 1.7.400.v20190518-1151)
Cannot satisfy dependency:
From: MyPlugin 0.4.0 (MetaCoderFeature.feature.group 0.4.0)
To: org.eclipse.equinox.p2.iu; org.eclipse.core.filesystem [1.7.0.v20170406-1337,1.7.0.v20170406-1337]
Cannot satisfy dependency:
From: Eclipse Platform 4.13.0.v20190916-1323 (org.eclipse.platform.feature.group 4.13.0.v20190916-1323)
To: org.eclipse.equinox.p2.iu; org.eclipse.core.filesystem [1.7.500.v20190620-1312,1.7.500.v20190620-1312]
Update 5
IN the feature editor I decided to click the [Compute] button and all the dependencies were recomputed. As a result below we have the new feature.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="MyPluginFeature"
label="MyPlugin"
version="0.4.0"
provider-name="ACME"
plugin="MyPlugin">
<description url="http://www.example.com/description">
</description>
<copyright url="http://www.example.com/copyright">
</copyright>
<license url="http://www.example.com/license">
</license>
<url>
<update label="Site do MyPlugin" url="http://example.org/myplugin"/>
</url>
<requires>
<import plugin="org.eclipse.ui" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.jface.text" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.core.resources" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.ui.views" version="3.8.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.jdt.ui" version="3.13.52" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.core" version="3.13.50" match="greaterOrEqual"/>
</requires>
<plugin
id="MyPlugin"
download-size="0"
install-size="0"
version="0.4.0"
unpack="false"/>
</feature>
In feature.xml only your own plug-ins should be specified as <plugin ... />, not the (Eclipse) plug-ins/bundles that are required.
For example,
<plugin
id="org.eclipse.core.resources"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
makes the plug-in/bundle org.eclipse.core.resources of the current version (version="0.0.0" is a placeholder that will be replaced by the current version when building the update site) part of the thing that can be installed. Because org.eclipse.core.resources is a singleton plug-in/bundle (Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true), it cannot be used with the plug-in/bundle of another version. This prevents your plug-in from being deployable in many Eclipse versions.

Why eclipse does not find my features?

I have written some eclipse plugins and consolidated them in featues. If the features does only contain plugins all is ok. But if I include a feature to a feature then I get the following error:
Unable to find feature "<featureName>" with version in range [2.6.0,2.6.1).
where featuerName is the including feature. I tinkered with the version numbers of the included feature without success.
here comes the including feature.xml
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="de.mdsd.xtext.support.validator.model.sdk"
label="Xtext Support Validator Generator Feature"
version="2.6.0.qualifier"
provider-name="XXX Software">
<description>
This plugin provides a small DSL for describing and generating an Xtext validator class.
</description>
<includes
id="de.mdsd.xtext.support.sdk.sdk"
version="[2.6.1,3.0.0)"/>
<requires>
<import plugin="org.eclipse.xtext"/>
<import plugin="org.eclipse.equinox.common" version="3.5.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.emf.codegen.ecore" version="2.10.2" match="greaterOrEqual"/>
<import plugin="de.mdsd.xtext.swtch.model" version="2.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.util"/>
<import plugin="org.eclipse.emf.ecore"/>
<import plugin="org.eclipse.emf.common"/>
<import plugin="org.eclipse.xtext.xbase.lib"/>
<import plugin="org.antlr.runtime"/>
<import plugin="org.eclipse.xtext.common.types"/>
<import plugin="org.apache.log4j"/>
<import plugin="org.eclipse.xtext.ui"/>
<import plugin="org.eclipse.ui.editors" version="3.5.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide" version="3.5.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.ui.shared"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.xtext.builder"/>
<import plugin="org.eclipse.xtext.common.types.ui"/>
<import plugin="org.eclipse.xtext.ui.codetemplates.ui"/>
<import plugin="org.eclipse.compare"/>
<import plugin="de.mdsd.xtext.support.sdk" version="2.1.0" match="greaterOrEqual"/>
<import plugin="de.mdsd.xtext.up.name.providerswitch.model" version="1.4.0" match="greaterOrEqual"/>
</requires>
<plugin
id="de.mdsd.xtext.support.validator.model"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="de.mdsd.xtext.support.validator.model.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
here comes the included feature.xml
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="de.mdsd.xtext.support.sdk.sdk"
label="Xtext Support Feature"
version="2.6.1.qualifier"
provider-name="MDSD Software">
<description url="http://www.example.com/description">
This is a collection of classes that support the development
of Xtext generated tools.
Now it contains switches and name providers for GenModel-, Ecore models and Xtext grammars.
</description>
<copyright url="http://www.example.com/copyright">
Copyright Olaf Bigalk 2013
</copyright>
<license url="http://www.example.com/license">
EPL
</license>
<requires>
<import plugin="org.eclipse.emf.ecore" version="2.9.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext" version="2.4.2" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtend.lib"/>
<import plugin="com.google.guava"/>
<import plugin="org.eclipse.xtext.xbase.lib"/>
<import plugin="org.eclipse.emf.codegen.ecore"/>
<import plugin="org.eclipse.xtext.ui" version="2.4.3" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.core" version="3.9.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtend.typesystem.emf" version="1.4.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.xbase" version="2.8.3" match="greaterOrEqual"/>
<import plugin="org.eclipse.emf" version="2.6.0" match="greaterOrEqual"/>
</requires>
<plugin
id="de.mdsd.xtext.support.sdk"
download-size="0"
install-size="0"
version=""
unpack="false"/>
<plugin
id="de.mdsd.xtext.support.xtend.utils"
download-size="0"
install-size="0"
version=""
unpack="false"/>
<plugin
id="de.mdsd.xtext.support.xbase.utils"
download-size="0"
install-size="0"
version=""
unpack="false"/>
<plugin
id="de.mdsd.xtext.support.utils"
download-size="0"
install-size="0"
version=""
unpack="false"/>
</feature>
What is the reason for this error ?
You can't use a version range like [2.6.1,3.0.0) in the includes element of a feature.xml.
Either specify the exact version of the feature to be included (2.6.1.qualifier) or specify 0.0.0 to not check the version.

Eclipse - how to reference current feature version inside feature manifest

Inside Enide Node.js feature manifest I am referencing "org.nodeclipse" feature.
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.nodeclipse.enide.nodejs.feature"
label="Enide Node.js"
version="0.10.0.qualifier"
...
<!-- http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Ffeature_manifest.html -->
<requires>
<import feature="org.chromium.sdk" version="0.3.9" match="compatible"/>
<import feature="org.chromium.debug" version="0.3.9" match="compatible"/>
<import feature="org.nodeclipse" version="0.10.0" match="perfect"/>
<import feature="com.eclipsesource.jshint.feature" version="0.9.9" match="greaterOrEqual"/>
The intention is that "org.nodeclipse" is updated with "org.nodeclipse.enide.nodejs.feature" and must be of the same version.
Can I reference version like version=feature.version match="perfect" ?

"Unknown extension point" in plugin.xml problem

In "Contributing to Eclipse" book it is written that to introduce an extension point you should type the next section in plugin.xml
<extension point="org.eclipse.contribution.junit.listeners">
<listener
class="org.eclipse.contribution.junit.RunTestAction$Listener">
</listener>
</extension>
But this code gives me the "Unknown extension point" error".
Read the book carefully, extension point is defined in the same plugin.xml as <extension-point id="listeners" name="Test Listeners"/>
Get sample code from Downloads at http://www.informit.com/store/product.aspx?isbn=0321205758
<?xml version="1.0" encoding="UTF-8"?>
<plugin
id="org.eclipse.contribution.junit"
name="JUnit Plug-in"
version="1.0.0"
provider-name=""
class="org.eclipse.contribution.junit.JUnitPlugin">
<runtime>
<library name="contribjunit.jar">
<export name = "*"/>
</library>
</runtime>
<requires>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.junit"/>
<import plugin="org.eclipse.debug.core"/>
<import plugin="org.eclipse.jdt.launching"/>
</requires>
<extension-point id="listeners" name="Test Listeners"/>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
objectClass="org.eclipse.jdt.core.IType"
id="org.eclipse.contribution.junit.runtest">
<action
label="Run Test"
class="org.eclipse.contribution.junit.RunTestAction"
enablesFor="1"
id="org.eclipse.contribution.junit.runtest.action">
</action>
</objectContribution>
</extension>
<extension point="org.eclipse.contribution.junit.listeners">
<listener
class="org.eclipse.contribution.junit.RunTestAction$Listener">
</listener>
</extension>
</plugin>
Cheers,
Max