| Summary: | P2 resolver fails with non-standard version and source plugin enabled | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Kamil Demecki <kodstark> | ||||||
| Component: | Tycho | Assignee: | Project Inbox <tycho-inbox> | ||||||
| Status: | RESOLVED INVALID | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | igor | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Kamil Demecki
Created attachment 209988 [details]
maven project to reproduce problem on tycho 0.11.0
Created attachment 209989 [details]
maven project to reproduce problem on tycho 0.13.0
It is exception Caused by: java.lang.RuntimeException: org.osgi.framework.BundleException: Invalid manifest header Bundle-Version: "CXXX_RYYY" : For input string: "CXXX_RYYY" at org.eclipse.tycho.p2.impl.publisher.SourcesBundleDependencyMetadataGenerator.getPublisherActions(SourcesBundleDependencyMetadataGenerator.java:80) at org.eclipse.tycho.p2.impl.publisher.AbstractMetadataGenerator.generateMetadata(AbstractMetadataGenerator.java:58) at org.eclipse.tycho.p2.impl.publisher.SourcesBundleDependencyMetadataGenerator.generateMetadata(SourcesBundleDependencyMetadataGenerator.java:52) at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.setupProjects(P2TargetPlatformResolver.java:125) at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.setupProject(DefaultTychoDependencyResolver.java:73) at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:85) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) Although Tycho should produce a better error message, version in pom.xml and bundle manifests are expected to match. In your case you need to change pom.xml version to 1.0.0-SNAPSHOT. Unfortunately MANIFEST.MF cannot contain CXXX_RYYY version because it contains letters.
Let me explain, not-small company has strict policy for source code tags and names of binaries packages deployed on customer server. Both contain version CXXX_RYYY (something like C\d{4,6}-R[A-Z]\d{4-6}}). I don't why but it is not possible to change it.
For packages which are used in OSGI container we define in MANIFEST.MF simply version 1.0.0 and it is OK because OSGI container matches versions only in Manifest and file name is not important and also we don't support multiple versions of same package in runtime.
For builds we are using mostly maven and ant as well and common point is remote maven repository. So for OSGI build we are referencing dependencies from nexus and use copy-dependendies goal to download them on disk and after that tycho publish-features-and-bundles goal is making local p2 repo from it. Previously instead local p2 we downloaded directory for tycho.targetPlatfrom option. In this scenario we need deploy modules on maven repository with version CXXX_RYYY (or 1.0.0-CXXX-RYYY - look at last senctence).
So we are using versions mostly to get correct jar for building. It has few advantages, for example works well for osgi and non-osgi builds and nexus is better scalable than p2 remote updatesite but it is not main point.
Build team evavaluated this kind of versioning in tycho and because of existing strictVersions=false they said this approach is possible.
It looks like bug occurs only when source bundle is generated.
Now case #1 works with p2 repository, Does your comment mean than in future tycho can break case #1? So it won't be possible use non-standard versions with p2 resolver?
One idea is use Manifest with version 1.0.0.CXXX-RYYY and and in maven 1.0.0-CXXX-RYYY. I tested it and it works OK for case #1 but still fals for case #3. I'm almost sure that in this kind of version it should work.
Provide a quality patch that correctly generates source bundles for projects that use non-standard version and we will consider it. I can't promise we'll accept the patch, but if the change is reasonable and does not break existing behaviour I may agree to apply it. Also, if all of your dependencies come from existing maven repositories (as it appears to be the case from comment 5), maven-bundle-plugin is probably a better approach. Thanks for information. I cannot promise patch but will see. I hope that case #1 won't be broken in future version of tycho ;) (from error message it looks that it is a accident that case #1 works but #3 not). I don't think maven-bundle-plugin is good choice. We are using Manifest first approach - developers like vanilla Eclipse only with target platform materialized on disk - we have one target platform for hundreds of plugins. Tycho allows apply minimal pom for each from this hundreds plugins and it is good - only problem is generate target platform (or local p2 repo) but is similar to situation in IDE and as well in runtime. That case #1 works in indeed an accident, there is a good chance we'll enforce versions equality between pom.xml and bundle manifest in the future. Ok, it is probably that tycho with version "CXXX_RYYY" in pom.xml and 1.0.0 in Manifest won't work. But what about versions: 1.0.0-CXXX-RYYY in pom.xml and 1.0.0.CXXX-RYYY in Manifest? It is correct version for Manifest but I'm not sure about maven - Tycho shows warning that versions don't match. As far I know now only 1.0.0-SNAPSHOT and 1.0.0.qualifier works with tycho out of box. (case #3 still doesn't work now but I case #1 should work in any future version if previous sentence is correct). 1.0.0-CXXX-RYYY in pom.xml and 1.0.0.CXXX-RYYY in Manifest are two different versions. 1.0.0-CXXX-RYYY is not a snapshot Maven version and will not be expanded by the build. 1.0.0.CXXX-RYYY both in pom.xml and in Manifest is expected to work, however. Good point ;) I was suggested by analogy of 1.0.0-SNAPSHOT and 1.0.0.qualifier. Indeed for version 1.0.0.CXXX-RYYY (dot instead of dash after 1.0.0) both cases #1 and #3 work. Thanks for help. I think it better approach to use 1.0.0.CXXX-RYYY than CXXX-RYYY in builds as it is more standard and I don't mind to close this bug. During release we're using version:set for setting versions in poms. I will try to find how Manifest version can be populated, probably by maven filtering or by qualifier possibilities. It appears to me as if the problem is solved, and Tycho doesn't need to be changed, right? Right. |