Open Phillipus opened 9 months ago
Did anything change in 4.0.5 that might affect how these are being resolved?
I have no clue, we changed the way filters are applied to be more generic so maybe the requirement simply don't match the environment, but the setup seems strange here and I did not found any reference to extra..
in any tests in Tycho itself so there is a good chance this is some kind of hidden feature no one is really aware of (the mentioned stack overflow is 10 years old!)
So best chance is provide an integration-test to demonstrate the issue and we can probably take a look here.
The issue is that Fragment A has a dependency on Fragment B but Tycho doesn't resolve Fragment B because all the package names in Fragment A are the same as Fragment A's host plug-in and it resolves the host plug-in instead of the Fragment. So I've added an Import-Package: packageName
statement to Fragment A where packageName
is unique to Fragment B. Tycho can now resolve Fragment B.
As for the extra..
line, as you say that doesn't seem to be documented anywhere and that reference to it is very old.
As for the extra.. line, as you say that doesn't seem to be documented
Actually it is documented:
extra.
- extra classpaths used to perform automated build. Classpath can either be relative paths, or platform urls referring to plug-ins and fragments of your development environment (e.g. ../someplugin/xyz.jar, platform:/plugins/org.apache.ant/ant.jar). Platform urls are recommended over relative paths;
So I don't know if this is something that Tycho should still support? It did in 4.0.4.
@Phillipus yes it is documented for pde build and Tycho try to support as much as possible but it seems there is no test for it --> it may break anytime :-\
So if there is demand for that feature a test would be required to make sure
I attempted a basic test consisting of two plug-ins and two fragments with one fragment dependent on the other and using the extra..
statement. It passed on Tycho 4.0.5. It was only when I introduced JUnit and the fragment classes were converted to JUnit tests that it didn't pass on Tycho 4.0.5. Therefore it's not straightforward so I'm going to leave it for now and see if anyone else comes across the problem.
Actually Tycho 4.0.5 is resolving the extra.. = platform:/fragment
line in build.properties
but it depends upon the order of declaration of modules in the pom.xml.
Suppose we have two fragments, org.foo.package1
and org.foo.package2
. If org.foo.package2
has a extra.. = platform:/fragment/org.foo.package1
declaration then the module order in the pom has to be:
<modules>
<module>org.foo.package1</module>
<module>org.foo.package2</module>
</modules>
In my own case I just re-arranged the order of modules in the pom and it works again.
But surely the order of modules should not matter?
@Phillipus then it seems we need to make sure it is used as a requirement in the resolving stage, would you mind to create a test that shows the wrong ordering issue?
I made a simple test with 2 plug-ins, 2 fragments and one pom.xml and I can't reproduce it with that simple example. My real life use case is more complicated with more than one pm, tests, and profiles.
I've finally created a reproducer, attached.
It involves extending a class from a fragment in another class that contains unit tests. There's a .mvn/maven.config
file with Tycho version set to 4.0.5
where the build fails. If this is set to 4.0.4
the build is successful.
Note - the comment above about the order of module declaration doesn't apply to this example.
Could someone try the attached project and see if they get the same result, or maybe I missed something?
I have:
Plugin
com.archimatetool.editor
Plugincom.archimatetool.canvas
- dependent oncom.archimatetool.editor
Fragment
com.archimatetool.editor.tests
- host iscom.archimatetool.editor
Fragmentcom.archimatetool.canvas.tests
- host iscom.archimatetool.canvas
Because some tests in
com.archimatetool.canvas.tests
extend tests incom.archimatetool.editor.tests
there is an additional entry in thecom.archimatetool.canvas.tests
build.properties
file:(I found the advice to do that here)
When I run the tests in the fragments using Tycho 4.0.5 I now get the error "Missing requirement: com.archimatetool.canvas.tests 4.0.0 requires 'org.eclipse.equinox.p2.iu; com.archimatetool.editor.tests 0.0.0' but it could not be found"
This is working with Tycho 4.0.4.
Did anything change in 4.0.5 that might affect how these are being resolved?