Discussion:
[tycho-user] Tycho and Project Classpath
Dietrich, Christian
2016-12-07 19:09:49 UTC
Permalink
Hi,

i have a question on how tycho provides the project classpath.
we have a user of our xtend maven plugin
calls it inside a tycho project.

- he has a lib folder with a jar in build.properties / Manifest
- the jar is not checked in but copied with the maven dependencies plugin
- the jar is visible to the tycho compiler plugin
- the jar is not visible inside project.getCompileClasspathElements

is that intended? how can this be circomvented?

Thanks
--
Christian Dietrich (Diplom-Informatiker (BA))
Softwareentwickler / -Architekt

Tel.: +49 (0) 711 / 34 21 91-0
Fax.: +49 (0) 711 / 34 21 91-29
Mobil: +49 (0) 151 / 173969 17
Mail: ***@itemis.de
XING: https://www.xing.com/profile/Christian_Dietrich8
Web: http://www.itemis.de
Skype: christiandietrich1982
ICQ: 125801794

itemis AG
Niederlassung SÃŒd
Industriestraße 6
70565 Stuttgart

Rechtlicher Hinweis:
Registergericht: Amtsgericht Dortmund HRB 20621 | Sitz der Gesellschaft:
LÃŒnen
Vorstand: Jens Wagener (Vorsitzender) | Wolfgang Neuhaus
Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.) | Michael Neuhaus | Jennifer
Fiorentino
Henrik Steudel
2016-12-09 11:47:12 UTC
Permalink
Hello,

if your dependency is copied during build process to the final location,
the problem could be that tycho resolves these classpath entries only
during initial computation of the target platform dependencies.
So, if your jar is not checked out , it is not present physically but
only be added as external dependency if nestedJarOrDir.isFile() is true
in
org.eclipse.tycho.core.maven.MavenDependencyInjector.newExternalDependencies(ArtifactDescriptor).


So, to test this, just copy the dependency jar to the final location
before maven starts and see if it works then.

We had a similar problem with scala-compiler not picking up any nested
jars which will be created during maven build runtime and therefore had
to prefix maven builds with ANT/Groovy step to create 0 byte nested jars.

Hope this helps
Henrik
Post by Dietrich, Christian
Hi,
i have a question on how tycho provides the project classpath.
we have a user of our xtend maven plugin
calls it inside a tycho project.
- he has a lib folder with a jar in build.properties / Manifest
- the jar is not checked in but copied with the maven dependencies plugin
- the jar is visible to the tycho compiler plugin
- the jar is not visible inside project.getCompileClasspathElements
is that intended? how can this be circomvented?
Thanks
--
Christian Dietrich (Diplom-Informatiker (BA))
Softwareentwickler / -Architekt
Tel.: +49 (0) 711 / 34 21 91-0
Fax.: +49 (0) 711 / 34 21 91-29
Mobil: +49 (0) 151 / 173969 17
XING: https://www.xing.com/profile/Christian_Dietrich8
Web: http://www.itemis.de
Skype: christiandietrich1982
ICQ: 125801794
itemis AG
Niederlassung Süd
Industriestraße 6
70565 Stuttgart
Registergericht: Amtsgericht Dortmund HRB 20621 | Sitz der
Gesellschaft: Lünen
Vorstand: Jens Wagener (Vorsitzender) | Wolfgang Neuhaus
Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.) | Michael Neuhaus |
Jennifer Fiorentino
_______________________________________________
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
--
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
***@entimo.com | http://www.entimo.com/

Vorstand: Jürgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum

Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB Berlin-Charlottenburg 85073
Sievers, Jan
2016-12-12 10:48:08 UTC
Permalink
Henrik is right.

this is basically a limitation of how we map the PDE/OSGi classpath to the maven classpath model early in the build (to make it available to non-Tycho maven plugins inside a Tycho build).
Unfortunately maven checks if a file exists when added to its classpath so we can only add local files if they exist, otherwise the build would fail.
If files are not referenced in the target/ folder, but rather .gitignored somewhere in your source tree, you should only have this problem once, any subsequent build should succeed.

Since we don't know when in the lifecycle a jar will be made available, the real fix would probably be to do something similar as in MavenDependencyInjector in a mojo just before the compile phase for every eclipse(test)-plugin to fill up any missing classpath entries.

Regards,
Jan



On 09/12/16 12:47, "tycho-user-***@eclipse.org on behalf of Henrik Steudel" <tycho-user-***@eclipse.org on behalf of ***@entimo.de> wrote:

Hello,

if your dependency is copied during build process to the final location, the problem could be that tycho resolves these classpath entries only during initial computation of the target platform dependencies.

So, if your jar is not checked out , it is not present physically but only be added as external dependency if nestedJarOrDir.isFile() is true in org.eclipse.tycho.core.maven.MavenDependencyInjector.newExternalDependencies(ArtifactDescriptor).


So, to test this, just copy the dependency jar to the final location before maven starts and see if it works then.


We had a similar problem with scala-compiler not picking up any nested jars which will be created during maven build runtime and therefore had to prefix maven builds with ANT/Groovy step to create 0 byte nested jars.

Hope this helps
Henrik



Am 07.12.2016 um 20:09 schrieb Dietrich, Christian:


Hi,


i have a question on how tycho provides the project classpath.
we have a user of our xtend maven plugin
calls it inside a tycho project.


- he has a lib folder with a jar in build.properties / Manifest
- the jar is not checked in but copied with the maven dependencies plugin
- the jar is visible to the tycho compiler plugin
- the jar is not visible inside project.getCompileClasspathElements


is that intended? how can this be circomvented?


Thanks


--
Christian Dietrich (Diplom-Informatiker (BA))
Softwareentwickler / -Architekt

Tel.: +49 (0) 711 / 34 21 91-0
Fax.: +49 (0) 711 / 34 21 91-29
Mobil: +49 (0) 151 / 173969 17
Mail:
***@itemis.de <mailto:***@itemis.de>
XING:
https://www.xing.com/profile/Christian_Dietrich8 <https://www.xing.com/profile/Christian_Dietrich8>
Web: http://www.itemis.de
Skype: christiandietrich1982
ICQ: 125801794

itemis AG
Niederlassung Süd
Industriestraße 6
70565 Stuttgart

Rechtlicher Hinweis:
Registergericht: Amtsgericht Dortmund HRB 20621 | Sitz der Gesellschaft: Lünen
Vorstand: Jens Wagener (Vorsitzender) | Wolfgang Neuhaus
Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.) | Michael Neuhaus | Jennifer Fiorentino













_______________________________________________
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




--
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
***@entimo.com | http://www.entimo.com/

Vorstand: Jürgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum

Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB Berlin-Charlottenburg 85073
Charlie Mordant
2016-12-12 11:29:57 UTC
Permalink
Hi Sievers,

Any news on that fix that do not validate classpath before anything else?

Regards,
Charlie
Post by Sievers, Jan
Henrik is right.
this is basically a limitation of how we map the PDE/OSGi classpath to the
maven classpath model early in the build (to make it available to non-Tycho
maven plugins inside a Tycho build).
Unfortunately maven checks if a file exists when added to its classpath so
we can only add local files if they exist, otherwise the build would fail.
If files are not referenced in the target/ folder, but rather .gitignored
somewhere in your source tree, you should only have this problem once, any
subsequent build should succeed.
Since we don't know when in the lifecycle a jar will be made available,
the real fix would probably be to do something similar as in
MavenDependencyInjector in a mojo just before the compile phase for every
eclipse(test)-plugin to fill up any missing classpath entries.
Regards,
Jan
Hello,
if your dependency is copied during build process to the final location,
the problem could be that tycho resolves these classpath entries only
during initial computation of the target platform dependencies.
So, if your jar is not checked out , it is not present physically but only
be added as external dependency if nestedJarOrDir.isFile() is true in
org.eclipse.tycho.core.maven.MavenDependencyInjector.
newExternalDependencies(ArtifactDescriptor).
So, to test this, just copy the dependency jar to the final location
before maven starts and see if it works then.
We had a similar problem with scala-compiler not picking up any nested
jars which will be created during maven build runtime and therefore had to
prefix maven builds with ANT/Groovy step to create 0 byte nested jars.
Hope this helps
Henrik
Hi,
i have a question on how tycho provides the project classpath.
we have a user of our xtend maven plugin
calls it inside a tycho project.
- he has a lib folder with a jar in build.properties / Manifest
- the jar is not checked in but copied with the maven dependencies plugin
- the jar is visible to the tycho compiler plugin
- the jar is not visible inside project.getCompileClasspathElements
is that intended? how can this be circomvented?
Thanks
--
Christian Dietrich (Diplom-Informatiker (BA))
Softwareentwickler / -Architekt
Tel.: +49 (0) 711 / 34 21 91-0
Fax.: +49 (0) 711 / 34 21 91-29
Mobil: +49 (0) 151 / 173969 17
https://www.xing.com/profile/Christian_Dietrich8 <
https://www.xing.com/profile/Christian_Dietrich8>
Web: http://www.itemis.de
Skype: christiandietrich1982
ICQ: 125801794
itemis AG
Niederlassung SÃŒd
Industriestraße 6
70565 Stuttgart
LÃŒnen
Vorstand: Jens Wagener (Vorsitzender) | Wolfgang Neuhaus
Aufsichtsrat: Prof. Dr. Burkhard Igel (Vors.) | Michael Neuhaus | Jennifer Fiorentino
_______________________________________________
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
--
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
Vorstand: JÃŒrgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum
Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB
Berlin-Charlottenburg 85073
_______________________________________________
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
--
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent
Loading...