Bug 566701 - Eclipse product export wizard fails if plug-ins specify different Execution Environments and "Generate p2 repository" selected
Summary: Eclipse product export wizard fails if plug-ins specify different Execution E...
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: Build (show other bugs)
Version: 4.17   Edit
Hardware: PC Windows 10
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: pde-build-inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2020-09-05 16:11 EDT by Phil Beauvoir CLA
Modified: 2023-03-07 13:24 EST (History)
3 users (show)

See Also:


Attachments
Test Project (6.64 KB, application/octet-stream)
2020-09-06 09:06 EDT, Phil Beauvoir CLA
no flags Details
Target File (611 bytes, text/plain)
2020-09-19 09:00 EDT, Phil Beauvoir CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Beauvoir CLA 2020-09-05 16:11:57 EDT
I have a RCP product file that exports perfectly using the Eclipse product export wizard in Eclipse 4.15 and 4.16, but fails in Eclipse 4.17.

All of the Execution Environments of my RCP plug-ins are set to JavaSE-1.8. And there are no target Execution Environments set in "Launching" tab of the product file.

But using Eclipse 4.17 product export leads to an error:

D:\projekts\archi\workspace415\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.linux.gtk.x86_64.xml:90: The following error occurred while executing this line:
D:\projekts\archi\workspace415\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.linux.gtk.x86_64.xml:939: The following error occurred while executing this line:
D:\dev\eclipse4.15\plugins\org.eclipse.pde.build_3.10.700.v20191228-1214\scripts\genericTargets.xml:240: A problem occured while invoking the director.
The following error occurred while executing this line:
D:\projekts\archi\workspace415\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.linux.gtk.x86_64.xml:939: The following error occurred while executing this line:
D:\dev\eclipse4.15\plugins\org.eclipse.pde.build_3.10.700.v20191228-1214\scripts\genericTargets.xml:240: A problem occured while invoking the director.

I suspect it has something to do with having the Execution Environments of some Eclipse plug-ins now being a mixture of JavaSE-1.8 and JavaSE-11. For example, in Eclipse 4.17 the Eclipse plug-ins org.eclipse.ui.cheatsheets, org.eclipse.help.webapp, org.eclipse.help.ui have their execution environments set to JavaSE-11.

I say this because if, in Eclipse 4.15 (where this is working fine) if I set the Execution Environment of one of my own plug-ins to JavaSE-11 the same error occurs.
Comment 1 Phil Beauvoir CLA 2020-09-05 16:28:09 EDT
D:\dev\eclipse4.17\plugins\org.eclipse.pde.build_3.10.800.v20200410-1419\scripts\genericTargets.xml:240: A problem occured while invoking the director.
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:571)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:106)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at jdk.internal.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:449)
	at org.apache.tools.ant.Target.performTasks(Target.java:470)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:34)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:712)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:532)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.ant.core.AntRunner.run(AntRunner.java:374)
	at org.eclipse.pde.internal.core.exports.FeatureExportOperation.runScript(FeatureExportOperation.java:468)
	at org.eclipse.pde.internal.core.exports.FeatureExportOperation.doExport(FeatureExportOperation.java:332)
	at org.eclipse.pde.internal.core.exports.ProductExportOperation.run(ProductExportOperation.java:134)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: D:\projekts\archi\workspace417\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.linux.gtk.x86_64.xml:939: The following error occurred while executing this line:
D:\dev\eclipse4.17\plugins\org.eclipse.pde.build_3.10.800.v20200410-1419\scripts\genericTargets.xml:240: A problem occured while invoking the director.
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:571)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at jdk.internal.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:449)
	at org.apache.tools.ant.Target.performTasks(Target.java:470)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
	at org.eclipse.ant.internal.core.ant.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
	... 25 more
Caused by: D:\dev\eclipse4.17\plugins\org.eclipse.pde.build_3.10.800.v20200410-1419\scripts\genericTargets.xml:240: A problem occured while invoking the director.
	at org.eclipse.equinox.p2.director.app.ant.DirectorTask.execute(DirectorTask.java:97)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at jdk.internal.reflect.GeneratedMethodAccessor221.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:449)
	at org.apache.tools.ant.Target.performTasks(Target.java:470)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
	at org.eclipse.ant.internal.core.ant.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
	... 38 more
Comment 2 Phil Beauvoir CLA 2020-09-05 16:38:39 EDT
In Eclipse 4.17 it is no longer possible to target against JavaSE 1.8 because the following plug-ins have their minimum execution environment set to 1.11:

org.eclipse.help.webapp
org.eclipse.help.ui
org.eclipse.help.base
org.eclipse.ui.cheatsheets

So this means that with a mixture of JavaSE 1.8 and JavaSE 1.11 execution environments in different plug-ins will cause a RCP product export to fail.
Comment 3 Phil Beauvoir CLA 2020-09-06 05:17:43 EDT
I've narrowed this down:

1. A Product consisting of different features/plug-ins where the Java Execution Environments may differ in the plug-in manifests. For example one plug-in might specify "JavaSE-1.8" and another "JavaSE-11" (such is the case with Eclipse 4.17 where the help plug-ins mentioned above are set to "JavaSE-11")
2. The Product Export Wizard has "Generate p2 repository" checked.

Under these conditions the product export fails with the error above.

Note - if "Generate p2 repository" is not checked then the export succeeds (However, this is not an option for our RCP product as the p2 files that we need are not generated.)
Comment 4 Phil Beauvoir CLA 2020-09-06 06:50:52 EDT
Another way to reproduce this bug is to simply set the Execution Environment in the Product Editor's "Launching" tab to JavaSE-11. Then run the export wizard with "Generate p2 repository" checked.
Comment 5 Phil Beauvoir CLA 2020-09-06 07:46:01 EDT
Bug #545653 could be related.
Comment 6 Vikas Chandra CLA 2020-09-06 08:48:52 EDT
Can you attach a simple project with steps to recreate tihs?
Comment 7 Phil Beauvoir CLA 2020-09-06 09:06:05 EDT
Created attachment 284056 [details]
Test Project

Attached is a Test project. This is simply generated from Eclipse's New Project Wizard, "Eclipse 4 RCP Application", as it generates a *.product file.

Note that in "MANIFEST.MF" the Bundle-RequiredExecutionEnvironment: JavaSE-1.11

1. Open "Test.product" file
2. Click on "Eclipse Product Export wizard"
3. Use these settings in the wizard:
   Configuration: /Test/Test.product
   Root directory: eclipse
   Generate p2 repository: selected
   Export for multiple platforms: selected
   Allow for binary cycles in target platform: selected
4. Select output platforms and select "Finish"

The error will occur.

This error will happen for any product export where one of the plug-ins is set to anything other than "JavaSE-1.8".
Comment 8 Phil Beauvoir CLA 2020-09-07 14:51:51 EDT
I found a clue in this comment: https://bugs.eclipse.org/bugs/show_bug.cgi?id=545653#c5

I created a file "p2.inf" alongside my .product file containing these lines:

provides.0.namespace = osgi.ee
provides.0.name = JavaSE
provides.0.version = 11.0.0

And the product export now works again with mixed Bundle-RequiredExecutionEnvironment declarations.

I have no idea what these lines mean or how this works around the issue but it may help in fixing this bug.

See https://wiki.eclipse.org/Equinox/p2/Customizing_Metadata
Comment 9 Marcel Austenfeld CLA 2020-09-17 09:34:09 EDT
Today I downloaded Eclipse 4.17 and have the same problem with a product export (RCP 3 with compatibility layer) on Windows 10 (Eclipse RCP export on 4.15, 4.16 worked fine):

Error messages:

I:\eclipse417\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86_64.xml:90: The following error occurred while executing this line:
I:\eclipse417\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86_64.xml:901: The following error occurred while executing this line:
I:\eclipse417\plugins\org.eclipse.pde.build_3.10.800.v20200410-1419\scripts\genericTargets.xml:240: A problem occured while invoking the director.
The following error occurred while executing this line:
I:\eclipse417\workspace\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\package.org.eclipse.pde.container.feature.win32.win32.x86_64.xml:901: The following error occurred while executing this line:
I:\eclipse417\plugins\org.eclipse.pde.build_3.10.800.v20200410-1419\scripts\genericTargets.xml:240: A problem occured while invoking the director.

I changed all my plugins to:

Bundle-RequiredExecutionEnvironment: JavaSE-14

I also tried the suggestion to create a file "p2.inf" alongside my .product file
to no avail, contents:

provides.0.namespace = osgi.ee
provides.0.name = JavaSE
provides.0.version = 14.0.0 



Is this considered a general bug? Are there any other workarounds available?
Comment 10 Phil Beauvoir CLA 2020-09-17 09:46:39 EDT
Marcel,

did you try to also include Java 11 in the p2.inf file:

provides.0.namespace = osgi.ee
provides.0.name = JavaSE
provides.0.version = 11.0.0

provides.1.namespace = osgi.ee
provides.1.name = JavaSE
provides.1.version = 14.0.0
Comment 11 Marcel Austenfeld CLA 2020-09-17 09:56:21 EDT
(In reply to Phil Beauvoir from comment #10)
> Marcel,
> 
> did you try to also include Java 11 in the p2.inf file:
> 
> provides.0.namespace = osgi.ee
> provides.0.name = JavaSE
> provides.0.version = 11.0.0
> 
> provides.1.namespace = osgi.ee
> provides.1.name = JavaSE
> provides.1.version = 14.0.0

Yes, I tried several combinations. The question is if the p2.inf is
honored. I definitely placed it in the same directory where the .product file is located.
Comment 12 Phil Beauvoir CLA 2020-09-17 10:02:56 EDT
Marcel:

I tested the p2.inf file with Java 11 and Java 14 entries and set all of my plug-ins in my RCP app to Java 14 as a test. It exported OK.

My theory is that for Eclipe 4.17 you have to include at least Java 11, as some of the Eclipse plug-ins are targeted to this version, as well as the Java versions that you target in your own plug-ins (except for Java 1.8 which seems OK).
Comment 13 Marcel Austenfeld CLA 2020-09-17 10:13:46 EDT
(In reply to Phil Beauvoir from comment #12)
> Marcel:
> 
> I tested the p2.inf file with Java 11 and Java 14 entries and set all of my
> plug-ins in my RCP app to Java 14 as a test. It exported OK.
> 
> My theory is that for Eclipe 4.17 you have to include at least Java 11, as
> some of the Eclipse plug-ins are targeted to this version, as well as the
> Java versions that you target in your own plug-ins (except for Java 1.8
> which seems OK).

I just tested my RCP by setting all plugins to Java 11. 

Bundle-RequiredExecutionEnvironment: JavaSE-11

Again no success. Same error. 

All plugins I include are now set again to JavaSE-14.
It might be that the product don't use the p2.inf?
Comment 14 Phil Beauvoir CLA 2020-09-17 10:30:04 EDT
Marcel: what are your product export settings in the dialog?

(I am not an expert on this)
Comment 15 Marcel Austenfeld CLA 2020-09-17 10:45:16 EDT
(In reply to Phil Beauvoir from comment #14)
> Marcel: what are your product export settings in the dialog?
> 
> (I am not an expert on this)

As you already described. Except: 'Export for multiple platforms: selected'

If I deactivate p2 than the export produces a non functional application.

I wonder what have changed since 4.16. No description can be found.
Comment 16 Phil Beauvoir CLA 2020-09-17 10:56:20 EDT
(In reply to Marcel Austenfeld from comment #15)
> (In reply to Phil Beauvoir from comment #14)
> > Marcel: what are your product export settings in the dialog?
> > 
> > (I am not an expert on this)
> 
> As you already described. Except: 'Export for multiple platforms: selected'
> 
> If I deactivate p2 than the export produces a non functional application.
> 
> I wonder what have changed since 4.16. No description can be found.

I think it has always been like this except that Eclipse 4.17 now has some plug-ins with BREE set to JavaSE-11, so there is a mixture of JavaSE-1.8 and JavaSE-11 BREEs.

I can reproduce this error with Eclipse 4.15 if I set the BREE of one of my app's plug-ins to JavaSE-11 while the others are JavaSE-1.8. If I add the p2.inf file the problem is solved.
Comment 17 Marcel Austenfeld CLA 2020-09-18 02:35:59 EDT
> I think it has always been like this except that Eclipse 4.17 now has some
> plug-ins with BREE set to JavaSE-11, so there is a mixture of JavaSE-1.8 and
> JavaSE-11 BREEs.
> 
> I can reproduce this error with Eclipse 4.15 if I set the BREE of one of my
> app's plug-ins to JavaSE-11 while the others are JavaSE-1.8. If I add the
> p2.inf file the problem is solved.

Hello Phil, 

strange because I used mixed BREEs in 4.15 and 4.16 successfully without any problems and without the p2.inf.
Comment 18 Phil Beauvoir CLA 2020-09-18 03:53:00 EDT
(In reply to Marcel Austenfeld from comment #17)
> > I think it has always been like this except that Eclipse 4.17 now has some
> > plug-ins with BREE set to JavaSE-11, so there is a mixture of JavaSE-1.8 and
> > JavaSE-11 BREEs.
> > 
> > I can reproduce this error with Eclipse 4.15 if I set the BREE of one of my
> > app's plug-ins to JavaSE-11 while the others are JavaSE-1.8. If I add the
> > p2.inf file the problem is solved.
> 
> Hello Phil, 
> 
> strange because I used mixed BREEs in 4.15 and 4.16 successfully without any
> problems and without the p2.inf.

That is strange. Do you have a .terget file in which you specify target features and plugins for your workspace?
Comment 19 Marcel Austenfeld CLA 2020-09-18 03:54:40 EDT
> I can reproduce this error with Eclipse 4.15 if I set the BREE of one of my
> app's plug-ins to JavaSE-11 while the others are JavaSE-1.8. If I add the
> p2.inf file the problem is solved.

Hello Phil,

I think I solved the problem. I was on the wrong path. After recalculating the dependencies of the feature of the main plugin I was able to export the product even without a p2.inf file.

In addition, I had a wrong *.ini after export which is why the app didn't start with no error message. So the confusion was complete.

Thanks for your help.
Comment 20 Phil Beauvoir CLA 2020-09-18 03:58:13 EDT
Marcel,

are you saying that you now can export in Eclipse 4.17 (and the target is set to 4.17) with BREE set to Java 14 and no p2.inf file? Are you sure you are targetting 4.17?


Phil
Comment 21 Marcel Austenfeld CLA 2020-09-18 04:24:04 EDT
(In reply to Phil Beauvoir from comment #20)
> Marcel,
> 
> are you saying that you now can export in Eclipse 4.17 (and the target is
> set to 4.17) with BREE set to Java 14 and no p2.inf file? Are you sure you
> are targetting 4.17?
> 
> 
> Phil

Hello Phil, what do you mean by targeting 4.17?

I use the PDE on a fresh install of Eclipse 4.17 to export the RCP product.
Comment 22 Phil Beauvoir CLA 2020-09-19 09:00:00 EDT
Created attachment 284187 [details]
Target File

To trigger this error you also need to ensure that you export the product to multiple platforms by installing the Equinox Target Components for all platforms.

This can be achieved by creating a .target file like the one attached, setting the target to this, and exporting with p2 repository and multiple platforms selected (and a plugin BREE set to Java 11.)
Comment 23 Marcel Austenfeld CLA 2020-09-19 09:56:14 EDT
(In reply to Phil Beauvoir from comment #22)
> Created attachment 284187 [details]
> Target File
> 
> To trigger this error you also need to ensure that you export the product to
> multiple platforms by installing the Equinox Target Components for all
> platforms.
> 
> This can be achieved by creating a .target file like the one attached,
> setting the target to this, and exporting with p2 repository and multiple
> platforms selected (and a plugin BREE set to Java 11.)

Hello Phil, thanks for the info. 

No I don't and can't use the multiple platforms feature. I export directly on the dedicated OS to catch errors and display glitches (CSS, OpenGL, dialog behaviour, etc.).

However, util now the export works for 4.17 with BREE set to Java 14 (still have to test it for Linux and MacOSX).
Comment 24 Eclipse Genie CLA 2022-09-10 09:32:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 25 Dilip Mane CLA 2023-03-07 13:24:21 EST
Its indeed p2.ini file issue.
Thanks for someones comment above

Solution is simple

1. create p2.ini file at same location where you have your .product file

2. content of p2.ini file would be as below
provides.0.namespace = osgi.ee
provides.0.name = JavaSE
provides.0.version = 17.0.0

NOTE - all your plugin must use the same java version as mentioned in p2.ini file
 or vice-a-versa


Start exporting again!

Cheers