Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » When I add p2 site created to the Target Platform modifies the Manifest file
When I add p2 site created to the Target Platform modifies the Manifest file [message #1779550] Tue, 09 January 2018 14:09 Go to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hello, I recently migrated an Eclipse 3.7 application to Eclipse 4.7 using the compatibility layer which works correctly. Now add the use of Tycho to complete the deploy of the application and to generate the p2 site I use the plugin p2-maven-plugin. The application defines a Target Platform and Features files.

When I add the created p2 site to the target platform and inspecting the org.eclipse.gemini.blueprint bundle, the Maniffest file is modified and no longer has the attribute Bundle-Activator: org.eclipse.gemini.blueprint.extender.internal. boot.
ChainActivator
. On the other hand, I have an Activator class that extends the AbstractUIPlugin that raises the plugin and since the manifest does not have that attribute, it does not follow the normal flow of execution.
Any clue?.



Thanks in advance!.

Eclipse 4.7 Oxygen
Tycho 1.1.0-SNAPSHOT
p2-maven-plugin 1.3.0
org.eclipse.gemini.blueprint:gemini-blueprint-extender:2.1.0.RELEASE
Java 1.8

[Updated on: Thu, 11 January 2018 14:46]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779558 is a reply to message #1779550] Tue, 09 January 2018 15:46 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Quote:
and to generate the p2 site I use the plugin p2-maven-plugin


I've never used the p2-maven-plugin, but from what I read of its description, I'm not sure it's designed to be inter-operable with Tycho.

Why don't you use Tycho's `eclipse-repository` to generate your p2 site?


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779571 is a reply to message #1779558] Tue, 09 January 2018 17:42 Go to previous messageGo to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Thank you for your answer, I comment a little better, the system that I migrates consists of several modules and has several folders containing the set of libraries to be used and the Target Platform points to these folders. After migrating to Eclipse 4.7 when I added Tycho I realized that it does not support the Directory, Installation and Features types, so it was necessary to generate a p2 site that contains all the libraries to be able to add it to the Target Platform. After investigating I concluded that the p2-maven-plugin tool was a good option to mavenize the project and create the p2 site because jars that are NOT osgi bundles will be "bundled" using bnd tool.
After removing all the errors I could deploy the project generating repository folders, products, etc. but when I wanted to execute the application it gave me a timeout error, that's why I found out by running the application from the Eclipse IDE in Debug Mode that Spring Context is not loaded.
Do you say that generate the p2 site to add to the Target Platform using Tycho ?.
Tycho convert jars that are NOT osgi bundles in "bundled"?


Best Regards.
Mariano

[Updated on: Tue, 09 January 2018 18:25]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779639 is a reply to message #1779571] Wed, 10 January 2018 15:25 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Unfortunately Tycho won't bundle-ize standard jars. You could split your build into two parts: the first would use p2-maven-plugin to bundle-ize jars and produces a p2 repository with your new bundles. The second would use Tycho and consume that generated repository and perform your build.

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779649 is a reply to message #1779639] Wed, 10 January 2018 18:08 Go to previous messageGo to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hello Brian, of course that's the idea, the steps I take are:
1 - I use the plugin p2-maven-plugin to create p2 site and bundle-ize standard jars that are not bundle-ized.
2 - I add the generated p2 site to my Maven repository (JFrog Artifactory).
3 - I add the Software Site to the Target Platform of my RCP project.
4 - I generate the deploy with Tycho.

The problem is that adding the p2 site generated to the Target Platform modifies the manifest of the org.eclipse.gemini.blueprint.extender_2.1.0.RELEASE package, eliminating the Bundle_activator attribute by changing the initialization flow.

An important issue detected when adding the Software Site to the Target Platfom is that the plugins they contain are installed in /PathToWorkspace/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins and when making modifications while maintaining the versioning they are not updated (obviously they should not be done but at this stage they are always the same jar and there are no version changes). The way I found to clean the plugins is from:
Windows -> preferences -> Target Platform -> Edit Target Platform an delete Software Site created.
Could it be that he is somehow taking old jar's?
Do you know any better way ?.


My parent pom contains, in addition to the modules to compile:
<properties>
<tycho-version> 1.1.0-SNAPSHOT </ tycho-version>
<project.build.sourceEncoding> UTF-8 </project.build.sourceEncoding>
</ properties>

<build>
<plugins>
           <plugin>
                  <groupId> org.eclipse.tycho </ groupId>
                  <artifactId> target-platform-configuration </ artifactId>
                  <version> $ {tycho-version} </ version>
                  <configuration>
                  <executionEnvironment> JavaSE-1.8 </ executionEnvironment>
                 <filters>
                       <filter>
                            <type> eclipse-plugin </ type>
                             <id> org.eclipse.jdt.core </ id>
                              <restrictTo>
                                      <version> 3.13.100.v20171123-1049 </ version>
                               </ restrictTo>
                           </ filter>
                   </ filters>
                    <target>
                        <artifact>
                            <groupId>  nameGroupId </ groupId>
                            <artifactId> nameArtifactId </ artifactId>
                            <version> 1.0.0-SNAPSHOT </ version>
                        </ artifact>
                    </ target>
                    <environments>
                           <environment>
                                <os> linux </ os>
                                <ws> gtk </ ws>
                                <arch> x86 </ arch>
                              </ environment>
                          <environment>
                                 <os> linux </ os>
                                 <ws> gtk </ ws>
                                  <arch> x86_64 </ arch>
                          </ environment>
                  </ environments>
                 </ configuration>
         </ plugin>
         <plugin>
                <groupId> org.eclipse.tycho </ groupId>
                <artifactId> tycho-maven-plugin </ artifactId>
                <version> $ {tycho-version} </ version>
                <extensions> true </ extensions>
         </ plugin>
</ plugins>



My product pom contains

<build>
      <plugins>
          <plugin>
              <groupId> org.eclipse.tycho </ groupId>
              <artifactId> tycho-p2-director-plugin </ artifactId>
              <version> $ {tycho-version} </ version>
              <configuration>
                  <formats>
                      <linux> tar.gz </ linux>
                  </ formats>
              </ configuration>
              <executions>
                  <execution>
                      <id> materialize-products </ id>
                      <goals>
                          <goal> materialize-products </ goal>
                      </ goals>
                  </ execution>
                  <execution>
                      <id> archive-products </ id>
                      <goals>
                          <goal> archive-products </ goal>
                      </ goals>
                  </ execution>
              </ executions>
          </ plugin>
      </ plugins>
  </ build>


Target pom contains

<artifactId> ftpos </ artifactId>
  <version> 1.0.0-SNAPSHOT </ version>
  <packaging> eclipse-target-definition </ packaging>
  <name> RCP Example Target Definition </ name>


Feature pom contains

<artifactId> nameArtifactId.features </ artifactId>
  <version> 1.0.0-SNAPSHOT </ version>
  <packaging> eclipse-feature </ packaging>
  <name> RCP Example Feature </ name>



All other modules are defined as:

  <artifactId> nameArtifactd </ artifactId>
  <version> 1.0.0-SNAPSHOT </ version>
  <packaging> eclipse-plugin </ packaging>


Any other clue?.

[Updated on: Thu, 11 January 2018 13:27]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779650 is a reply to message #1779649] Wed, 10 January 2018 18:36 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

It's hard to diagnose build failures via forum posts. But I'm 100% certain that the PDE target platform code does not rewrite manifests of downloaded artifacts, especially removing bundle activators.

Note that p2 considers two artifacts with the same ID (org.eclipse.gemini.blueprint.extender) and version (2.1.0.RELEASE) to be identical: it won't bother re-downloading or replacing the artifact. If you had previously installed a broken instance -- perhaps you were experimenting with the p2-maven-plugin? -- then the broken version may well still be present.

You might want to delete the contents of .metadata/.plugins/org.eclipse.pde.core/.bundle_pool (after quitting Eclipse) and then try rebuilding your target platform. Or use a fresh workspace.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779700 is a reply to message #1779650] Thu, 11 January 2018 12:10 Go to previous messageGo to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hi Brian, the first thing I did is remove the plugins from:
Windows -> preferences -> Target Platform -> Edit Target Platform to delete Software Site created, but this does not fix the problem.
Now I start from a new workspace and follow the same steps, create the p2 site, copy it to a Tomcat and add it to the Target Platform.
I attach the plugin created in the p2 site and the same plugin when I add it to the Target Platform and it is installed in /PathToWorkspace/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins. By comparing the Manifest you can see that the Bundle-Activator attribute has been removed.
Also attach the original jar downloaded from the Maven repository, if you compare the manifest file downloaded from the maven repository with the manifest file from the p2 site they are identical since the jar's that are already bundle-ize are not overwritten when using the plugin p2-maven-plugin.

On the other hand I have in the Target Platform added the Software site http://download.eclipse.org/releases/oxygen
Eclipse e4 Tools Developer Resources
Equinox Target Components
Eclipse Platform SDK
Eclipse PDE Plug-in Developer Resources

And if I look at some of the packages installed in /PathToWorkspace / .metadata / .plugins / org.eclipse.pde.core / .bundle_pool / plugins like for example org.eclipse.core.runtime it has the attribute Bundle-Activator in the same way as if I download it from the Maven repository. With which I deduce that it is a theme with the p2 site created.
What do you think?

[Updated on: Thu, 11 January 2018 13:30]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779789 is a reply to message #1779700] Fri, 12 January 2018 15:19 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Deleting the target platform from within Eclipse won't be sufficient: the item could be retained in the bundle-pool. Try doing it from a fresh workspace.

BTW: You don't need to need to use Tomcat to serve up a p2 site if you're just using it locally: use a file: URL.

What's almost certain to be happening is that p2 is finding an org.eclipse.gemini.blueprint.extender 2.1.0.RELEASE from somewhere other than your crafted p2 repository. Remember that p2 treats an artifact with the same ID and same version as identical, regardless of whether they have the same bits. It's a matter of finding those duplicates.

I'd also try looking on your machine for all occurrences of org.eclipse.gemini.blueprint.extender_2.1.0.RELEASE*.jar.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779798 is a reply to message #1779789] Fri, 12 January 2018 19:46 Go to previous messageGo to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hi, Brian, as I was saying before, I tried it in two ways, removing the plugin from Windows -> preferences -> Target Platform -> Edit Target Platform and as you mention from a fresh workspace, neither of which worked.
As you said it was likely that there is some reference at some point to an old copy of the jar and is recovering the old version. Therefore I delete all occurrences of the jar that was in my file system with the command:
find -name org.eclipse.gemini.blueprint.extender_2.1.0.RELEASE.jar -exec rm -f {} \;
Then when I started adding the p2 site to the Target Platform I get error

session context was: (profile = TARGET_DEFINITION: resource: / ftpos-target, phase = org.eclipse.equinox.internal.p2.engine.phases.Install, operand = null -> [R] org.eclipse.gemini.blueprint. extend 2.1.0.RELEASE, action = org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.InstallBundleAction).
The artifact file for osgi.bundle, org.eclipse.gemini.blueprint.extender, 2.1.0.RELEASE was not found.


Which is the same error I got when trying to remove the plugins manually instead of using Windows -> preferences -> Target Platform -> Edit Target Platform.

Any advice?.

[Updated on: Mon, 15 January 2018 11:32]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1779937 is a reply to message #1779798] Mon, 15 January 2018 21:43 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 772
Registered: January 2012
Senior Member

Removing plugins the Target Platform -> Edit Target Platform does not guarantee that items are deleted from the internal bundle pool that is maintained by p2. Even using a fresh workspace is no guaranteee if you have Oomph installed as Oomph uses a central bundle pool in ~/.p2/bunde_pool. But you should be safe now that you've deleted all jars using find.

And indeed, you are now encountering problems trying to resolve org.eclipse.gemini.blueprint.extender as canonical location for the Gemini bundles *is Maven Central*. For some reason they have not published a separate p2 repository, and p2 does not have a way to pull down IUs from Maven Central.

But because these Gemini jars have OSGi metadata, you can use Tycho in `pomDependencies=consider` mode and pull them into your reactor by using normal Maven <dependencies>. See the following for details:

https://wiki.eclipse.org/Tycho/Target_Platform#.22POM_dependencies_consider.22

The only downside to this approach is that it is Tycho-specific: the IDE doesn't know how to resolve these artifacts from Maven Central. The approach I use is to generate p2 repository as part of our build that includes these pom-dependencies. I then use that p2 repository as the target platform.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1780191 is a reply to message #1779937] Thu, 18 January 2018 13:44 Go to previous messageGo to next message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hi Brian, you were right, I had to delete from the console gemini and the servicemix jar's of the file system. In some way they are referenced either from the cache, from the .m2 folder from the workspace metadata, etc.
After eliminating all the occurrences and updating some references I was able to advance in the debug. Now I have the error that I attached, basically it's the type

Error creating bean with name 'imageManager' defined in URL [bundleentry: //17.fwk1877453512/META-INF/spring/ftpos-domain-manager-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy. $ Proxy22 implementing com.zetti.common.dao.BaseMutableDAO, com.zetti.common.dao.BaseImmutableDAO, org. springframework.aop.SpringProxy, org.springframework.aop.framework.Advised, org.springframework.core.DecoratingProxy 'to required type' com.zetti.ftpos.domain.dao.impl.image.ImageNDAO 'for property' dao '; nested exception is java.lang.IllegalStateException: Can not convert value of type 'com.sun.proxy. $ Proxy22 implementing com.zetti.common.dao.BaseMutableDAO, com.zetti.common.dao.BaseImmutableDAO, org.springframework.aop. SpringProxy, org.springframework.aop.framework.Advised, org.springframework.core.DecoratingProxy 'to required type' com.zetti.ftpos.domain.dao.impl.image.ImageNDAO 'for property' dao ': no ​​matching editors or conversion strategy found.


I'm investigating what the problem may be when creating the beans. Maybe it's just that the ImagenDao class has no interface and has to declare it. I try and post it if it works.
  • Attachment: tycho_log
    (Size: 91.32KB, Downloaded 57 times)

[Updated on: Thu, 18 January 2018 13:51]

Report message to a moderator

Re: When I add p2 site created to the Target Platform modifies the Manifest file [message #1780532 is a reply to message #1780191] Tue, 23 January 2018 18:23 Go to previous message
Mariano Camarzana is currently offline Mariano CamarzanaFriend
Messages: 17
Registered: July 2017
Junior Member
Hello everyone, well the final problem was that they were not defining the interfaces of the created DAO's. I think Spring version 4.3.7 makes all proxies and apparently the version I used before Spring 4.2.0 did not validate.

Thanks Brian for the tips.
Best Regards.
Previous Topic:CSS styling for Nebula Gallery and custom widgets in Eclipse 4.6
Next Topic:How to add "Show in..." option to Project Explorer context menu in my RCP?
Goto Forum:
  


Current Time: Fri Sep 21 19:15:18 GMT 2018

Powered by FUDForum. Page generated in 0.03110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top