Discussion:
[tycho-user] How to extend tycho-osgi-runtime via TychoOsgiRuntimeArtifacts?
Marco Lehmann-Mörz
2017-10-16 21:42:54 UTC
Permalink
Hello everybody,

I want tycho to include my osgi-bundle into its runtime. (It registers a
custom url via org.osgi.service.url.URLStreamHandlerService.)
It does not work.

What a tried so far:

1. I wrote the osgi bundle that provides the service (BTW: build with
tycho).
2. I wrote a maven extension that exports a plexus component with role
TychoOsgiRuntimeArtifacts and hint mycustomurl.
3. I registered the extension in the parent pom of another tycho build
where I want tycho to use my custom url in p2 repository loading.

The extension is never loaded. Any ideas?
--
Tschö Marco
Sievers, Jan
2017-10-17 06:46:11 UTC
Permalink
Looks like the OSGi runtime should be extensible but I never tried this.

You may have to add it as a maven core build extension so the classloader sees it, i.e.

<extensions>true</extensions>

similar to tycho itself, see [1].


this where you would have to start debugging (mvnDebug):

https://github.com/eclipse/tycho/blob/master/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java#L122

Regards
Jan


[1] https://github.com/eclipse/tycho-demo/blob/7f78a458a4b368472995610a338ac5e68c2b7709/itp01/pom.xml#L31

On 16.10.17, 23:43, "tycho-user-***@eclipse.org on behalf of Marco Lehmann-Mörz" <tycho-user-***@eclipse.org on behalf of ***@gmail.com> wrote:

Hello everybody,


I want tycho to include my osgi-bundle into its runtime. (It registers a custom url via org.osgi.service.url.URLStreamHandlerService.)
It does not work.


What a tried so far:


1. I wrote the osgi bundle that provides the service (BTW: build with tycho).

2. I wrote a maven extension that exports a plexus component with role TychoOsgiRuntimeArtifacts and hint mycustomurl.

3. I registered the extension in the parent pom of another tycho build where I want tycho to use my custom url in p2 repository loading.


The extension is never loaded. Any ideas?


--
Tschö Marco
Sievers, Jan
2017-10-17 06:54:35 UTC
Permalink
another thing is to make sure the plexus descriptors are generated, like in

https://github.com/eclipse/tycho/blob/5951a62696123bff26cead593ca54d7b124a70e6/pom.xml#L365-L377

otherwise dependency injection will not happen

Regards
Jan

On 17.10.17, 08:46, "tycho-user-***@eclipse.org on behalf of Sievers, Jan" <tycho-user-***@eclipse.org on behalf of ***@sap.com> wrote:

Looks like the OSGi runtime should be extensible but I never tried this.

You may have to add it as a maven core build extension so the classloader sees it, i.e.

<extensions>true</extensions>

similar to tycho itself, see [1].


this where you would have to start debugging (mvnDebug):

https://github.com/eclipse/tycho/blob/master/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java#L122

Regards
Jan


[1] https://github.com/eclipse/tycho-demo/blob/7f78a458a4b368472995610a338ac5e68c2b7709/itp01/pom.xml#L31

On 16.10.17, 23:43, "tycho-user-***@eclipse.org on behalf of Marco Lehmann-Mörz" <tycho-user-***@eclipse.org on behalf of ***@gmail.com> wrote:

Hello everybody,


I want tycho to include my osgi-bundle into its runtime. (It registers a custom url via org.osgi.service.url.URLStreamHandlerService.)
It does not work.


What a tried so far:


1. I wrote the osgi bundle that provides the service (BTW: build with tycho).

2. I wrote a maven extension that exports a plexus component with role TychoOsgiRuntimeArtifacts and hint mycustomurl.

3. I registered the extension in the parent pom of another tycho build where I want tycho to use my custom url in p2 repository loading.


The extension is never loaded. Any ideas?


--
Tschö Marco











_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Marco Lehmann-Mörz
2017-10-17 19:02:56 UTC
Permalink
Hello Jan,

thanks for your answers.

I followed your advices/suggestions and get the following outcome:

====================== CUT HERE =======================

1) No implementation for org.apache.maven.plugin.LegacySupport was bound.
while locating org.eclipse.tycho.core.osgitools.BuildPropertiesParserImpl
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent:
ClassRealm[plexus.core, parent: null]] (via modules:
org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent:
ClassRealm[plexus.core, parent: null]] (via modules:
org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.shared.BuildPropertiesParser
while locating org.eclipse.tycho.core.osgitools.OsgiBundleProject
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent:
ClassRealm[plexus.core, parent: null]] (via modules:
org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
at
ClassRealm[coreExtension>mygroupid:my-artifact:tycho-mvnurl:1.0.0-SNAPSHOT,
parent: ClassRealm[plexus.core, parent: null]] (via modules:
org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.TychoProject annotated with
@com.google.inject.name.Named(value=eclipse-plugin)

1 error
at
com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
at
org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at
org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at java.util.AbstractMap.get(AbstractMap.java:187)
at
org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject(DefaultTychoResolver.java:62)
at
org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:90)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:267)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
... 11 more


====================== CUT HERE =======================

It seems my maven core extension (now registered via .mvn/extensions.xml)
triggers a whole lot of other components.
Obviously my extension has a dependency to org.eclipse.tycho:tycho-core,
but for only one class.

Does this help?
Maybe I can setup a sample project, but this will take some time.

Thanks in advance,
Marco
Post by Sievers, Jan
another thing is to make sure the plexus descriptors are generated, like in
https://github.com/eclipse/tycho/blob/5951a62696123bff26cead593ca54d
7b124a70e6/pom.xml#L365-L377
otherwise dependency injection will not happen
Regards
Jan
Looks like the OSGi runtime should be extensible but I never tried this.
You may have to add it as a maven core build extension so the classloader sees it, i.e.
<extensions>true</extensions>
similar to tycho itself, see [1].
https://github.com/eclipse/tycho/blob/master/tycho-core/
src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java#
L122
Regards
Jan
[1] https://github.com/eclipse/tycho-demo/blob/
7f78a458a4b368472995610a338ac5e68c2b7709/itp01/pom.xml#L31
Hello everybody,
I want tycho to include my osgi-bundle into its runtime. (It
registers a custom url via org.osgi.service.url.URLStreamHandlerService.)
It does not work.
1. I wrote the osgi bundle that provides the service (BTW: build with tycho).
2. I wrote a maven extension that exports a plexus component with
role TychoOsgiRuntimeArtifacts and hint mycustomurl.
3. I registered the extension in the parent pom of another tycho
build where I want tycho to use my custom url in p2 repository loading.
The extension is never loaded. Any ideas?
--
Tschö Marco
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
Tschö Marco
Sievers, Jan
2017-10-18 06:51:49 UTC
Permalink
I never tried extending the tycho OSGi runtime and there are no tests covering this scenario, so I can't promise much.
But yes, a bug with a sample project would help focus the discussion

Regards
Jan

On 17.10.17, 21:03, "tycho-user-***@eclipse.org on behalf of Marco Lehmann-Mörz" <tycho-user-***@eclipse.org on behalf of ***@gmail.com> wrote:

Hello Jan,


thanks for your answers.


I followed your advices/suggestions and get the following outcome:


====================== CUT HERE =======================


1) No implementation for org.apache.maven.plugin.LegacySupport was bound.
while locating org.eclipse.tycho.core.osgitools.BuildPropertiesParserImpl
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.shared.BuildPropertiesParser
while locating org.eclipse.tycho.core.osgitools.OsgiBundleProject
at ClassRealm[coreExtension>mygroupid:my-artifact:1.0.0-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
at ClassRealm[coreExtension>mygroupid:my-artifact:tycho-mvnurl:1.0.0-SNAPSHOT, parent: ClassRealm[plexus.core, parent: null]] (via modules: org.eclipse.sisu.wire.Wire
Module -> org.eclipse.sisu.plexus.PlexusBindingModule)
while locating org.eclipse.tycho.core.TychoProject annotated with @com.google.inject.name.Named(value=eclipse-plugin)


1 error
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at java.util.AbstractMap.get(AbstractMap.java:187)
at org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject(DefaultTychoResolver.java:62)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:90)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:267)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
... 11 more





====================== CUT HERE =======================




It seems my maven core extension (now registered via .mvn/extensions.xml) triggers a whole lot of other components.
Obviously my extension has a dependency to org.eclipse.tycho:tycho-core, but for only one class.


Does this help?
Maybe I can setup a sample project, but this will take some time.


Thanks in advance,
Marco




2017-10-17 8:54 GMT+02:00 Sievers, Jan <***@sap.com>:

another thing is to make sure the plexus descriptors are generated, like in

https://github.com/eclipse/tycho/blob/5951a62696123bff26cead593ca54d7b124a70e6/pom.xml#L365-L377

otherwise dependency injection will not happen

Regards
Jan

On 17.10.17, 08:46, "tycho-user-***@eclipse.org on behalf of Sievers, Jan" <tycho-user-***@eclipse.org on behalf of
***@sap.com> wrote:

Looks like the OSGi runtime should be extensible but I never tried this.

You may have to add it as a maven core build extension so the classloader sees it, i.e.

<extensions>true</extensions>

similar to tycho itself, see [1].


this where you would have to start debugging (mvnDebug):


https://github.com/eclipse/tycho/blob/master/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java#L122 <https://github.com/eclipse/tycho/blob/master/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java#L122>

Regards
Jan


[1]
https://github.com/eclipse/tycho-demo/blob/7f78a458a4b368472995610a338ac5e68c2b7709/itp01/pom.xml#L31 <https://github.com/eclipse/tycho-demo/blob/7f78a458a4b368472995610a338ac5e68c2b7709/itp01/pom.xml#L31>

On 16.10.17, 23:43, "tycho-user-***@eclipse.org on behalf of Marco Lehmann-Mörz" <tycho-user-***@eclipse.org on behalf of
***@gmail.com> wrote:

Hello everybody,


I want tycho to include my osgi-bundle into its runtime. (It registers a custom url via org.osgi.service.url.URLStreamHandlerService.)
It does not work.


What a tried so far:


1. I wrote the osgi bundle that provides the service (BTW: build with tycho).

2. I wrote a maven extension that exports a plexus component with role TychoOsgiRuntimeArtifacts and hint mycustomurl.

3. I registered the extension in the parent pom of another tycho build where I want tycho to use my custom url in p2 repository loading.


The extension is never loaded. Any ideas?


--
Tschö Marco











_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

https://dev.eclipse.org/mailman/listinfo/tycho-user <https://dev.eclipse.org/mailman/listinfo/tycho-user>

_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user








--
Tschö Marco

Loading...