Discussion:
[tycho-user] Tycho does not pick up java files during compilation
Alexander Baier
2014-01-14 17:13:56 UTC
Permalink
Hello,

I am currently trying to get my little project to compile with tycho. I
have no clue, what I have done wrong--I configured everything as in the
example project given here: (At least I think so)
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp01

I have attached a listing of my project directory layout and this are
the two pom.xml files used in the project:

This is the parent pom:
----------------------------------------------------------------
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>edu.teco.tacet</groupId>
<artifactId>parent</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>0.19.0</tycho-version>
</properties>

<modules>
<module>edu.teco.tacet.meta</module>
</modules>

<repositories>
<repository>
<id>eclipse-kepler</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/kepler</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
----------------------------------------------------------------

And this the child pom:
----------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>parent</artifactId>
<groupId>edu.teco.tacet</groupId>
<version>0.0.1</version>
</parent>

<artifactId>meta</artifactId>
<version>0.0.1</version>
<packaging>eclipse-plugin</packaging>
</project>
----------------------------------------------------------------

And the MANIFEST.MF in the child project:
----------------------------------------------------------------
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Meta
Bundle-SymbolicName: meta;singleton:=true
Bundle-Version: 0.0.1
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: edu.teco.tacet.meta,
edu.teco.tacet.meta.impl,
edu.teco.tacet.meta.util
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
----------------------------------------------------------------
Andreas Sewe
2014-01-14 17:26:13 UTC
Permalink
Hello,
What did I miss here? If you need further information, I will gladly
provide that!
how does you build.properties file look like (to be found in your
eclipse-plugin projects basedir)?

Andreas
--
Codetrails UG (haftungsbeschränkt)
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Alexander Baier
2014-01-14 21:50:24 UTC
Permalink
Post by Alexander Baier
Hello,
What did I miss here? If you need further information, I will gladly
provide that!
how does you build.properties file look like (to be found in your
eclipse-plugin projects basedir)?
There is none. Should there be one?

Thanks,
--
Alexander Baier
Mikhail Kalkov
2014-01-15 07:51:05 UTC
Permalink
Yes, I think something like the following file is necessary to let Tycho
know where to find source code (source=) and what else to include in the
jar (bin.includes=). If you created your plug-in with Eclipse PDE, this
file should have been created automatically.

### BEGIN build.properties example ###
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

### END build.properties example ###

Kind regards,
Mikhail Kalkov
Post by Alexander Baier
Post by Alexander Baier
Hello,
What did I miss here? If you need further information, I will gladly
provide that!
how does you build.properties file look like (to be found in your
eclipse-plugin projects basedir)?
There is none. Should there be one?
Thanks,
--
Alexander Baier
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Alexander Baier
2014-01-15 09:49:54 UTC
Permalink
Hello Mikhail,

This actually works! I included the build.properties with the contents
you supplied and Tycho picks up my classes.
Post by Mikhail Kalkov
output.. = bin/
I do not really get this statement, though. Why does tycho honor the
"source... =" statement, but not the output one? My classes are still
place under target/. Don't get me wrong, I like them being there, I am
just wondering.

Thanks,
--
Alexander Baier
Mikhail Kalkov
2014-01-15 10:12:37 UTC
Permalink
I believe the output directive is only used by Eclipse PDE. In other words,
that's where classes end up when Eclipse builds your plug-in.

I guess, Tycho devs decided to skip this directive in order to avoid
interference with IDE and because they anyway need a place for other
derived artifacts such as p2 repos, product installations, zip archives etc.

/Mikhail

Kind regards,
Mikhail Kalkov
Post by Alexander Baier
Hello Mikhail,
This actually works! I included the build.properties with the contents
you supplied and Tycho picks up my classes.
Post by Mikhail Kalkov
output.. = bin/
I do not really get this statement, though. Why does tycho honor the
"source... =" statement, but not the output one? My classes are still
place under target/. Don't get me wrong, I like them being there, I am
just wondering.
Thanks,
--
Alexander Baier
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Alexander Baier
2014-01-15 10:28:57 UTC
Permalink
Post by Mikhail Kalkov
I believe the output directive is only used by Eclipse PDE. In other words,
that's where classes end up when Eclipse builds your plug-in.
I guess, Tycho devs decided to skip this directive in order to avoid
interference with IDE and because they anyway need a place for other
derived artifacts such as p2 repos, product installations, zip archives etc.
That makes sense.

Thinking about this a bit more: The tycho homepage
(http://eclipse.org/tycho/) mentions that tycho is also a tool for
building OSGi bundles. Someone who builds an OSGi bundle (not an eclipse
plugin) and uses Maven/Tycho as his build tool and a differet IDE/Editor
than eclipse, why is someone like that required to specify source
locations in an eclipse specific way? Wouldn't it make more sense to
specify this in a Maven or OSGi way? In addition to that I think tycho
should pick up the sources at the standard maven locations
(src/main/...) in case it cannot find a build.properties file.

Regards,
--
Alexander Baier
Mickael Istria
2014-01-15 10:35:25 UTC
Permalink
Wouldn't it make more sense to specify this in a Maven or OSGi way?
It seems to me that Tycho somehow allows this kind of settings too.
In addition to that I think tycho should pick up the sources at the standard maven locations (src/main/...) in case it cannot find a build.properties file.
That's a very good idea! Please turn it into a feature request in
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Tycho

Cheers,
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
Alexander Baier
2014-01-15 11:32:47 UTC
Permalink
Post by Mickael Istria
Wouldn't it make more sense to specify this in a Maven or OSGi way?
It seems to me that Tycho somehow allows this kind of settings too.
Oh, well, I did not know/check that. Nevertheless, the argument about
considering default maven locations is still valid, I think.
Post by Mickael Istria
In addition to that I think tycho should pick up the sources at the
standard maven locations (src/main/...) in case it cannot find a
build.properties file.
That's a very good idea! Please turn it into a feature request in
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Tycho
Done! See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=425737

Regards,
--
Alexander Baier
Mikhail Kalkov
2014-01-15 11:36:55 UTC
Permalink
I don't know why Tycho honors the POM's project/build/outputDirectory but
not project/build/sourceDirectory.
Have you tested this? The topic starter didn't have it in his poms and I
have never tried with project/build/sourceDirectory instead of
build.properties either since the latter works out-of-box for me.
tycho should pick up the sources at the standard maven locations
(src/main/...) in case it cannot find a build.properties file
I agree that it sounds like a good idea, and thank you for filing an
enhancement request. It may however already check the standard Eclipse
location (src/) in this case.

Kind regards,
Mikhail Kalkov
Wouldn't it make more sense to specify this in a Maven or OSGi way?
It seems to me that Tycho somehow allows this kind of settings too.
In addition to that I think tycho should pick up the sources at the standard maven locations (src/main/...) in case it cannot find a build.properties file.
That's a very good idea! Please turn it into a feature request in
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Tycho
Cheers,
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets<http://twitter.com/mickaelistria>
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Alexander Baier
2014-01-15 12:08:30 UTC
Permalink
Post by Mikhail Kalkov
tycho should pick up the sources at the standard maven locations
(src/main/...) in case it cannot find a build.properties file
I agree that it sounds like a good idea, and thank you for filing an
enhancement request. It may however already check the standard Eclipse
location (src/) in this case.
Which case do you mean by "in this case"? In the case the
build.properties is absent, tycho does not pick up anything under src/
in my experience.

--
Alexander
Mikhail Kalkov
2014-01-15 12:18:37 UTC
Permalink
In absense of build.properties Tycho does not find source code in
src/main/java, but I think it would find the code directly in src/, e.g. in
src/com/acme/example/Class.java. I maybe wrong though since I haven't
tested this.

Kind regards,
Mikhail Kalkov
Post by Alexander Baier
Post by Mikhail Kalkov
tycho should pick up the sources at the standard maven locations
(src/main/...) in case it cannot find a build.properties file
I agree that it sounds like a good idea, and thank you for filing an
enhancement request. It may however already check the standard Eclipse
location (src/) in this case.
Which case do you mean by "in this case"? In the case the
build.properties is absent, tycho does not pick up anything under src/
in my experience.
--
Alexander
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Alexander Baier
2014-01-15 12:25:22 UTC
Permalink
Post by Mikhail Kalkov
In absense of build.properties Tycho does not find source code in
src/main/java, but I think it would find the code directly in src/, e.g. in
src/com/acme/example/Class.java. I maybe wrong though since I haven't
tested this.
I just tested this and it does not pick up files even if they are
located directly under src/.

Regards,
--
Alexander Baier
Igor Fedorenko
2014-01-15 12:23:04 UTC
Permalink
Post by Alexander Baier
Post by Mikhail Kalkov
I believe the output directive is only used by Eclipse PDE. In other words,
that's where classes end up when Eclipse builds your plug-in.
I guess, Tycho devs decided to skip this directive in order to avoid
interference with IDE and because they anyway need a place for other
derived artifacts such as p2 repos, product installations, zip archives etc.
That makes sense.
Thinking about this a bit more: The tycho homepage
(http://eclipse.org/tycho/) mentions that tycho is also a tool for
building OSGi bundles. Someone who builds an OSGi bundle (not an eclipse
plugin) and uses Maven/Tycho as his build tool and a differet IDE/Editor
than eclipse, why is someone like that required to specify source
locations in an eclipse specific way? Wouldn't it make more sense to
specify this in a Maven or OSGi way? In addition to that I think tycho
What is "OSGi way" to specify sources location? Can you point me at any
documentation that describes this convention?

--
Regards,
Igor
Post by Alexander Baier
should pick up the sources at the standard maven locations
(src/main/...) in case it cannot find a build.properties file.
Regards,
--
Alexander Baier
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Mickael Istria
2014-01-15 12:35:21 UTC
Permalink
Post by Igor Fedorenko
What is "OSGi way" to specify sources location? Can you point me at any
documentation that describes this convention?
Users of Felix BND plugin generally put stuff in src/main/java.
Have a look at some projects using BND to see their usual layout:
https://github.com/search?q=%22%3Cpackaging%3Ebundle%3C%2Fpackaging%3E%22&type=Code&ref=searchresults
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
Igor Fedorenko
2014-01-15 12:40:49 UTC
Permalink
This is "BND way". I don't see why Tycho should prefer BND over PDE or
any other conventional layout.

--
Regards,
Igor
Post by Mickael Istria
Post by Igor Fedorenko
What is "OSGi way" to specify sources location? Can you point me at any
documentation that describes this convention?
Users of Felix BND plugin generally put stuff in src/main/java.
https://github.com/search?q=%22%3Cpackaging%3Ebundle%3C%2Fpackaging%3E%22&type=Code&ref=searchresults
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Alexander Baier
2014-01-15 12:38:24 UTC
Permalink
Post by Igor Fedorenko
What is "OSGi way" to specify sources location? Can you point me at any
documentation that describes this convention?
I am pretty new to this whole OSGi thing, so I can't provide you with
any further information here, sorry.

But taking the default _maven_ locations into account would go a long
way I think. At least that is what I expectec tycho to do on account of
it being a maven plugin.

HTH,
--
Alexander Baier
Igor Fedorenko
2014-01-15 12:45:47 UTC
Permalink
Conventional Maven project does not have enough metadata. You have to
have META-INF/MANIFEST.MF, for example. Also, OSGi bundle without any
java sources is very legitimate layout for projects that ship resources
only, like fragments with native code, for example. Assuming Maven
layout will be rather surprising for this kind of projects.

--
Regards,
Igor
Post by Alexander Baier
Post by Igor Fedorenko
What is "OSGi way" to specify sources location? Can you point me at any
documentation that describes this convention?
I am pretty new to this whole OSGi thing, so I can't provide you with
any further information here, sorry.
But taking the default _maven_ locations into account would go a long
way I think. At least that is what I expectec tycho to do on account of
it being a maven plugin.
HTH,
--
Alexander Baier
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Andreas Sewe
2014-01-15 13:46:12 UTC
Permalink
Post by Igor Fedorenko
Conventional Maven project does not have enough metadata. You have to
have META-INF/MANIFEST.MF, for example. Also, OSGi bundle without any
java sources is very legitimate layout for projects that ship resources
only, like fragments with native code, for example. Assuming Maven
layout will be rather surprising for this kind of projects.
Still (and I am sure you know this), every Maven project inherits a
project.build.sourceDirectory of src/main/java from the Super POM.
Assuming this layout in the absence of a build.properties is therefore
entirely reasonable.

Also, even Maven projects containing no src/main/java folder still
inherit this value of project.build.sourceDirectory (and the
maven-compiler-plugin will look there for sources). So I don't buy your
argument about the resource-only Maven projects not having any source
folders; their POMs disagree (unless someone goes to great length and
overrides project.build.sourceDirectory, but I haven't seen this in the
wild).

Best wishes,

Andreas
--
Codetrails UG (haftungsbeschränkt)
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Igor Fedorenko
2014-01-15 13:53:00 UTC
Permalink
Yes, I know a thing or two about pom.xml ;-) and still I believe Maven
conventional project layout does not work for Tycho. I gave more
detailed explanation in the bug, if you are interested.

--
Regards,
Igor
Post by Andreas Sewe
Post by Igor Fedorenko
Conventional Maven project does not have enough metadata. You have to
have META-INF/MANIFEST.MF, for example. Also, OSGi bundle without any
java sources is very legitimate layout for projects that ship resources
only, like fragments with native code, for example. Assuming Maven
layout will be rather surprising for this kind of projects.
Still (and I am sure you know this), every Maven project inherits a
project.build.sourceDirectory of src/main/java from the Super POM.
Assuming this layout in the absence of a build.properties is therefore
entirely reasonable.
Also, even Maven projects containing no src/main/java folder still
inherit this value of project.build.sourceDirectory (and the
maven-compiler-plugin will look there for sources). So I don't buy your
argument about the resource-only Maven projects not having any source
folders; their POMs disagree (unless someone goes to great length and
overrides project.build.sourceDirectory, but I haven't seen this in the
wild).
Best wishes,
Andreas
Igor Fedorenko
2014-01-15 12:16:02 UTC
Permalink
No, output goes to target/... by default because "mvn clean" would not
work otherwise.

--
Regards,
Igor
Post by Mikhail Kalkov
I believe the output directive is only used by Eclipse PDE. In other
words, that's where classes end up when Eclipse builds your plug-in.
I guess, Tycho devs decided to skip this directive in order to avoid
interference with IDE and because they anyway need a place for other
derived artifacts such as p2 repos, product installations, zip archives etc.
/Mikhail
Kind regards,
Mikhail Kalkov
Hello Mikhail,
This actually works! I included the build.properties with the contents
you supplied and Tycho picks up my classes.
Post by Mikhail Kalkov
output.. = bin/
I do not really get this statement, though. Why does tycho honor the
"source... =" statement, but not the output one? My classes are still
place under target/. Don't get me wrong, I like them being there, I am
just wondering.
Thanks,
--
Alexander Baier
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Andreas Sewe
2014-01-15 10:17:31 UTC
Permalink
Post by Alexander Baier
Post by Mikhail Kalkov
output.. = bin/
I do not really get this statement, though. Why does tycho honor the
"source... =" statement, but not the output one? My classes are still
place under target/. Don't get me wrong, I like them being there, I am
just wondering.
I don't know why Tycho honors the POM's project/build/outputDirectory
but not project/build/sourceDirectory. Probbaly it causes the least
surprise for other Maven plugins if done this way. But maybe Tobias or
Jan can enlighten us.

Anyway, I find it helpful to have a

output.. = target/classes/

in my build.properties. This keeps PDE from either complaining about a
non-existent directory or from creating a fresh "bin" directory outside
of "target", both of which are annoying.

Hope this helps.

Andreas
--
Codetrails UG (haftungsbeschränkt)
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Mickael Istria
2014-01-15 10:00:00 UTC
Permalink
Post by Alexander Baier
I do not really get this statement, though. Why does tycho honor the
"source... =" statement, but not the output one?
I think so far, there has been no good reason for honoring them,
everyone is happy with having them in target/ and it works pretty well,
probably better that it would by honoring this output.
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
Loading...