Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Maven Location
Maven Location [message #1838337] Mon, 22 February 2021 15:34 Go to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2903
Registered: July 2012
Senior Member
Hi,

are there plans to add support for the new m2e PDE Integration to Targlets? I mean, is it possible or will it be possible to also add artifacts from Maven locations to a Targlet?

I find it very useful to integrate artifacts directly from Maven without the need to wrap them additionally in a p2 update site. For creating a setup I read that Targlets are the preferred way instead of activating a Target Definition. But I do not see how to create a Target Definition based on Targlets that reference Maven locations.

Or maybe I still haven't figured out how everything works together. At the moment I have the understanding that Oomph is only able to work with p2 update sites. But of course the new Maven location type is pretty new, so no blaming, just a question.

Greez,
Dirk
Re: Maven Location [message #1838345 is a reply to message #1838337] Mon, 22 February 2021 16:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
Sorry, I've not investigated that nor do I have to time to investigate that. Someone will need to contribute some type of resource toward such an effort.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1847029 is a reply to message #1838345] Tue, 12 October 2021 16:28 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
Hello folks,

Short of adding support for Maven dependencies in targlets, is there a way to cause the automatic generation of the .target file via the TargetDefinitionGenerator annotation to preserve pre-existing locations in the .target file if they are unsupported by targlets?

For example, here's a Maven location that I would like to preserve in the generate target:

      <location includeSource="true" missingManifest="generate" type="Maven">
          <groupId>io.github.java-diff-utils</groupId>
          <artifactId>java-diff-utils</artifactId>
          <version>4.9</version>
          <type>jar</type>
      </location>


It has type="Maven" which TargetDefinitionGenerator could use to determine that it should preserve it since it's not a supported type.

That would allow to maintain the list of P2 requirements in the targlets, and Maven requirements in the .target file.

And that would be used in conjunction with a "Target Platform" task to activate the generate .target instead of the Modular Target.

Thoughts?

Another bonus question: what is the difference between TargetDefinitionGenerator and TargetDefinitionGeneratorX ?

Thanks!


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1847031 is a reply to message #1847029] Tue, 12 October 2021 17:25 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6690
Registered: July 2009
Senior Member
Unfortunately that's not possible. Currently the TargetDefinitionGenerator is a generator and not a merger. I could review a patch if you're going to provide one through Gerrit.

What is TargetDefinitionGeneratorX?


Re: Maven Location [message #1847032 is a reply to message #1847031] Tue, 12 October 2021 17:37 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
Ok, I'll try to submit a patch if I find some time :fingerscrossed:

I saw that the current TargetDefinitionGenerator handles the .target files as plain text files.

Do you know what the API to manipulate .target files is and is it accessible or easy to add to the Oomph target platform?

Otherwise I'll try with plain text manipulation or some basic XML parsing.

As for TargetDefinitionGeneratorX, I saw it in the target platform of the EMF Oomph setup:

<?xml version="1.0" encoding="UTF-8"?>
<base:Annotation
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:base="http://www.eclipse.org/oomph/base/1.0"
    source="http:/www.eclipse.org/oomph/targlets/TargetDefinitionGeneratorX">
  <detail key="location">
    <value>${emf.git.clone.location/releng/org.eclipse.emf.parent/tp/org.eclipse.emf.tp.target}</value>
  </detail>
...
</base:Annotation>


Perhaps it's a simple renaming to disable the auto-generation of the target platform?


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1847044 is a reply to message #1847032] Wed, 13 October 2021 05:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
Yes, the X was added to disable the generation because this is done manually for EMF.

Probably easier than trying to do some merging is to capture the additional things in the model, e.g.,
<?xml version="1.0" encoding="UTF-8"?>
<base:Annotation
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:base="http://www.eclipse.org/oomph/base/1.0"
    source="extraLocations">
  <detail key="extra1">
    <value>
      &lt;location includeSource=&quot;true&quot; missingManifest=&quot;generate&quot; type=&quot;Maven&quot;>
          &lt;groupId>io.github.java-diff-utils&lt;/groupId>
          &lt;artifactId>java-diff-utils&lt;/artifactId>
          &lt;version>4.9&lt;/version>
          &lt;type>jar&lt;/type>
      &lt;/location>
    </value>
  </detail>
</base:Annotation>
And then to generate literally what's in the value, perhaps with <!-- ${key} --> before it.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1847057 is a reply to message #1847044] Wed, 13 October 2021 09:28 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
That sounds like a much easier solution, thanks Ed.

Did you mean that this annotation would be a child of the TargetDefinitionGenerator one to keep everything together?

So the full annotation would be this:

<?xml version="1.0" encoding="UTF-8"?>
<base:Annotation
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:base="http://www.eclipse.org/oomph/base/1.0"
    source="http:/www.eclipse.org/oomph/targlets/TargetDefinitionGenerator">
  <annotation
      source="extraLocations">
    <detail
        key="extra1">
      <value>
        &lt;location includeSource=&quot;true&quot; missingManifest=&quot;generate&quot; type=&quot;Maven&quot;>
            &lt;groupId>io.github.java-diff-utils&lt;/groupId>
            &lt;artifactId>java-diff-utils&lt;/artifactId>
            &lt;version>4.9&lt;/version>
            &lt;type>jar&lt;/type>
        &lt;/location>
      </value>
    </detail>
  </annotation>
  <detail key="location">
    <value>${git.clone.location}/plugins/core/com.adacore.qgen.bls.platform/${scope.project.name}-${eclipse.target.platform}.target</value>
  </detail>
  <detail key="extraUnits"/>
  <detail key="includeAllPlatforms">
    <value>false</value>
  </detail>
  <detail key="includeSource">
    <value>true</value>
  </detail>
  <detail key="generateVersions">
    <value>false</value>
  </detail>
</base:Annotation>


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1847060 is a reply to message #1847057] Wed, 13 October 2021 10:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
Yes, keeping it all together would be good and that was my intent.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1847074 is a reply to message #1847060] Wed, 13 October 2021 17:18 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
I gave this a try here: https://git.eclipse.org/r/c/oomph/org.eclipse.oomph/+/186444

but I ran into an issue. When the targlet gets activated, it fails because of the non-satisfied requirement to the extra bundle.

I first tried changing my bundle MANIFEST to use a package dependency instead of the bundle dependency thinking it would allow the targlet to resolve. I got a similar missing requirement error.

Then I thought activation was the issue, so I disabled the "Activate Target" attribute of the targlet and added a separate "Target Platform" task to activate the generated target instead of the Modular Target.

This also failed because even without activation the targlet is still resolved.

Calculating requirements and dependencies.
Cannot complete the request.  Generating details.
ERROR: org.eclipse.equinox.p2.director code=10053 Cannot complete the install because one or more required items could not be found.
  at org.eclipse.oomph.targlets.internal.core.TargletContainer.forceUpdate(TargletContainer.java:827)
  at org.eclipse.oomph.setup.targlets.impl.TargletTaskImpl$4.run(TargletTaskImpl.java:1174)
  at org.eclipse.oomph.util.pde.TargetPlatformUtil.runWithTargetPlatformService(TargetPlatformUtil.java:120)
  at org.eclipse.oomph.setup.targlets.impl.TargletTaskImpl.perform(TargletTaskImpl.java:1035)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.doPerformNeededSetupTasks(SetupTaskPerformer.java:3851)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.access$1(SetupTaskPerformer.java:3794)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer$WorkspaceUtil$1.run(SetupTaskPerformer.java:5178)
  at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
  at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2338)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer$WorkspaceUtil.performNeededSetupTasks(SetupTaskPerformer.java:5172)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer$WorkspaceUtil.access$0(SetupTaskPerformer.java:5170)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performNeededSetupTasks(SetupTaskPerformer.java:3785)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.performTriggeredSetupTasks(SetupTaskPerformer.java:3760)
  at org.eclipse.oomph.setup.internal.core.SetupTaskPerformer.perform(SetupTaskPerformer.java:3638)
  at org.eclipse.oomph.setup.ui.wizards.ProgressPage$9.run(ProgressPage.java:600)
  at org.eclipse.oomph.setup.ui.wizards.ProgressPage$11$1.run(ProgressPage.java:727)
  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
  ERROR: org.eclipse.equinox.p2.director code=0 Software being installed: artificial_root 1.0.0.v1634140032243
  ERROR: org.eclipse.equinox.p2.director code=0 Missing requirement: org.irit.xtext.blocklibrary.tests 1.0.0.v20211013-174709 (org.irit.xtext.blocklibrary.tests 1.0.0.v20211013-174709) requires 'java.package; com.github.difflib 4.9.0' but it could not be found
  ERROR: org.eclipse.equinox.p2.director code=1 Cannot satisfy dependency:
    ERROR: org.eclipse.equinox.p2.director code=0 From: artificial_root 1.0.0.v1634140032243
    ERROR: org.eclipse.equinox.p2.director code=0 To: org.eclipse.equinox.p2.iu; com.adacore.qgen.toolkit.workspace.feature.group 0.0.0
  ERROR: org.eclipse.equinox.p2.director code=1 Cannot satisfy dependency:
    ERROR: org.eclipse.equinox.p2.director code=0 From: QGen Toolkit Workspace 1.0.0.v20211013-174709 (com.adacore.qgen.toolkit.workspace.feature.group 1.0.0.v20211013-174709)
    ERROR: org.eclipse.equinox.p2.director code=0 To: org.eclipse.equinox.p2.iu; org.irit.xtext.blocklibrary.tests 0.0.0


Ultimately I returned to a bundle dependency, but marked it as optional so that the targlets resolves successfully and gets to the TargetDefinitionGenerator.

The TargetDefinitionGenerator then runs correctly and generates the target file.

Finally I had to add an ordering constraint (Successor property) to make the "Target Platform" task run after the "Modular Target" task.

And I think I also had to re-set "Activate Target" to true on the "Modular Target" because otherwise TargetDefinitionGenerator doesn't get called.

So to summarize, here's what worked:

- Add the extraLocations annotation
- Set the extra bundle dependency as optional in my plugin MANIFEST to allow successful targlet resolution without the extra locations
- Keep the Modular Target's "Activate Target" attribute to true
- Add a "Target Platform" task with a name equal to the "name" entry in the TargetDefinitionGenerator
- Use the Successors/Predecessors properties to make the "Modular Target" task run before the "Target Platform"
- Make sure the project containing the generated targets gets imported by the setup in order for the "Target Platform" task to see the generated target.

Overall I'm not super happy with having to use so many hacks to make it work, but it works :shrug:

Thoughts?


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1847082 is a reply to message #1847074] Thu, 14 October 2021 07:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
I see now that you were expecting these extra locations to somehow have an impact on targlet resolution, but of course that's not possible because *.target generation happens after resolution. I get the feeling that your hacks actually result in all artifacts being downloaded twice because PDE does not use the shared bundle pool used by the targlet container.

Maybe you are better off to use the targlet support for editing the *.target which you maintain manually using the support for that:

https://wiki.eclipse.org/Oomph_Targlets

Then you don't need a targlet task at all. But you're probably also relying in source locators and on using this *.target in a Tycho build, right?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1847102 is a reply to message #1847082] Thu, 14 October 2021 15:47 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
Indeed my hacks resulted in the artifacts getting downloaded twice.

Yes I am relying on source locators in the targlet to get projects imported to the workspace. And yes the only reason for the .target to exist is to support a Tycho build.

I tried your suggestion. I wasn't aware of the possibility to create targlets within .target files. Nice!

I was thus able to define my usual targlet + the additional Maven dependency thanks to the m2e PDE integration.

Now the remaining problem is how to get that into Tycho. Tycho doesn't support targlets. And targlet activation inside a .target does not trigger TargetDefinitionGenerator.

Any ideas?


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1847173 is a reply to message #1847102] Mon, 18 October 2021 07:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
I'm really not sure what to suggest. I don't think the hack really makes much sense if what's added to the *.target file is needed in the resolution to begin with. It seems to me the only missing thing is that while Tycho recognizes the m2e extension, it doesn't recognize targlets...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1847211 is a reply to message #1847173] Tue, 19 October 2021 12:38 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
That makes sense... I can't find existing discussions on the support of targlets in Tycho so I'll open one.

Thanks for the help in any case!


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1857201 is a reply to message #1847211] Tue, 24 January 2023 12:17 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
Hello folks,

I just noticed a new kind of child in an Oomph Targlet which is "Composed Target". From a quick experiment it seems to compose a targlet with an externally defined target platform in a .target file. That file can contain Maven locations as created and understood by the m2e extension.

It seems to work nicely. I haven't completed all the work but I think it solves the problem I had in this thread! Thanks :)

Are there release notes available somewhere for Oomph? I discovered that feature randomly, but I would like to learn about new features more regularly. What are the recommended channels to receive such news?

Thanks!


Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1857202 is a reply to message #1857201] Tue, 24 January 2023 12:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
We should have release notes, but we don't.

The portal

https://projects.eclipse.org/projects/tools.oomph

has release records:

https://projects.eclipse.org/projects/tools.oomph/releases/1.27.0

which contain a links:

https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&classification=Tools&list_id=21325965&product=Oomph&query_format=advanced&version=1.27.0

So you might have found this one:

https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&classification=Tools&list_id=21325965&product=Oomph&query_format=advanced&version=1.25.0

to notice this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=580054

which even has a nice *.pdf attachment...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1857206 is a reply to message #1857202] Tue, 24 January 2023 15:20 Go to previous messageGo to next message
Elie Richa is currently offline Elie RichaFriend
Messages: 72
Registered: February 2016
Member
Thanks for the pointers, Ed!

Elie Richa, Ph.D
Software Engineer, AdaCore
https://www.adacore.com
Re: Maven Location [message #1857207 is a reply to message #1857206] Tue, 24 January 2023 16:54 Go to previous messageGo to next message
Marco MosconiFriend
Messages: 63
Registered: July 2009
Member
Hi Ed,

let's say we use the new "Composed Targets" to include/merge an existing .target file with regular p2 locations in our Oomph setup's TargletTask.
Do we still benefit from the advantages of Targlets, like usage of bundle pool, compared to integration of the .target file via TargetDefinitionTask?
Re: Maven Location [message #1857213 is a reply to message #1857207] Tue, 24 January 2023 18:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
The composed targets are resolved separately and first, not using the bundle pool mechanism. But, if you are using targets with maven dependencies/locations then m2e caches the downloaded artifacts in its own artifact pool in the ~/.m2 folder, so that mechanism is very similar with similar benefits.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Maven Location [message #1857215 is a reply to message #1857213] Wed, 25 January 2023 06:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33251
Registered: July 2009
Senior Member
Try asking here:

https://github.com/eclipse/birt/discussions


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Configuring tools.jar as JRE Library of Java 8 JRE ?
Next Topic:Project name template and name conflict in maven import task
Goto Forum:
  


Current Time: Sat Nov 02 12:03:11 GMT 2024

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

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

Back to the top