Tycho fails to resolve reference from product to eclipse-feature from a different reactor build
I've got two reactor builds:
The first one builds some bundles and an according feature. After a successful clean install
the feature is in my local Maven repo. Tycho has also generated p2 meta information ...-p2artifacts.xml
and ...-p2metadata.xml
The second build contains a feature-based product which is referencing the feature built in the first reactor. When trying a clean install
Tycho complains about an unresolved feature - the one of the other reactor build.
Failed to execute goal org.eclipse.tycho:tycho-p2-repository-plugin:0.12.0:assemble-repository [开发者_JAVA百科...] ["Unable to satisfy dependency from TestApp2 1.0.0 to my.testlib.feature.feature.group [1.0.0.201109081051]."]
As you can see I'm using Tycho 0.12.0 which should be able to resolve artifacts of the local maven repository when the pomDependencies=consider
flag has been set, which I did.
I looked in the generated p2 meta information of my local maven repo and I found a little difference in the feature version. The version of the feature in the p2artifacts.xml is the following:
version='1.0.0.201109071453'
Comparing the two versions
1.0.0.201109081051 // what tycho looks for
1.0.0.201109071453 // what's in my local mvn repo
there is only a difference in the last bit, which might be a timestamp.
Does anyone know why tycho is complaining about the unresolved feature? Does the timestamp matter?
Update: Since the timestamp of the second build changes each build I assume it's the current timestamp.
probably you are using ".qualifier" as version suffix when referencing the feature in your .product. ".qualifier" is replaced by the build timestamp by default, so this is probably not what you want. Try using "0.0.0" (=latest) instead.
Your product file seems to specify the version 1.0.0.qualifier
in the reference to your feature in the other reactor.
Due to a bug in Tycho (bug 373817) the qualifier
literal is not replaced by the right timestamp in this case: Tycho uses the timestamp of the current build (as you correctly observed) instead of the timestamp from the feature version which is available in the target platform.
As Jan already pointed out, the workaround for this problem is to use the version 0.0.0
in the reference to the feature.
Like with all "inclusion" references (i.e. features "include" plug-ins, and products "includes" features), Tycho will replace that version with the actual version from the target platform. (Note: Artifacts from previous Tycho builds with mvn clean install
are automatically part of the target platform.) But with 0.0.0
this will even work correctly in case of two reactors.
For reference: With newer Tycho versions, the error message in case of the setup described in the question is different:
Failed to execute goal org.eclipse.tycho:tycho-p2-publisher-plugin:0.22.0:publish-products (...): Exception while publishing product (...)\test.product: publishing result: [Included element my.testlib.feature.feature.group 1.0.0.201109081051 is missing. Cannot determine filter for requirement to this element.]
This message occurs due to the same Tycho bug, and the workaround is the same.
精彩评论