Bug 469127 - OSGI version number-format in pom file with packaging 'eclipse-repository'
Summary: OSGI version number-format in pom file with packaging 'eclipse-repository'
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-02 08:22 EDT by Nicola noname CLA
Modified: 2021-04-28 16:52 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola noname CLA 2015-06-02 08:22:04 EDT
we stumbled upon a problem that a maven version number in a pom file with packaging 'eclipse-repository' needs to be in an OSGI format. (x.y.z-qualifier // x.y.z.version).
An entry on Stackoverflow already mentions the problem. http://stackoverflow.com/questions/30034447/maven-tycho-not-a-valid-osgi-version

I added a small project on github to test and check the problem: https://github.com/nipelle/tychoRepoVersion

To us it doesn't make sense to use an OSGI formatted version number in a pom file. Is this problem known and will it be addressed?

Thx
Nico

Stacktrace:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.22.0:build-qualifier-aggregator (default-build-qualifier-aggregator) on project my.repository: Not a valid OSGi version 1.1.0-2015-06-01_14-10-52-123456 for project MavenProject: myTychoTest:my.repository:1.1.0-2015-06-01_14-10-52-123456 @ /workspace/myRepository/pom.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.22.0:build-qualifier-aggregator (default-build-qualifier-aggregator) on project my.repository: Not a valid OSGi version 1.1.0-2015-06-01_14-10-52-123456 for project MavenProject: myTychoTest:my.repository:1.1.0-2015-06-01_14-10-52-123456 @ /workspace/myRepository/pom.xml
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Not a valid OSGi version 1.1.0-2015-06-01_14-10-52-123456 for project MavenProject: myTychoTest:my.repository:1.1.0-2015-06-01_14-10-52-123456 @ /workspace/myRepository/pom.xml
	at org.eclipse.tycho.buildversion.BuildQualifierMojo.getParsedOSGiVersion(BuildQualifierMojo.java:177)
	at org.eclipse.tycho.buildversion.BuildQualifierMojo.calculateQualifiedVersion(BuildQualifierMojo.java:143)
	at org.eclipse.tycho.buildversion.BuildQualifierMojo.execute(BuildQualifierMojo.java:134)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
[ERROR]
Comment 1 Mickael Istria CLA 2015-06-02 08:31:39 EDT
I agree with this request. In order to use Nexus more extensively when publishing p2 repositories with Tycho, our project (JBoss Tools) cannot use OSGi versions for p2 repositories.

However, there is a simple way to disable it without too much risk: see in https://github.com/mickaelistria/jbosstools-server/commit/5738e9d420355326e3cdda13a8be3af3a489b901 the part which disable the default-build-qualifier-aggregator mojo execution.
Comment 2 Björn Michael CLA 2015-10-15 05:33:42 EDT
I think the version pattern in org.eclipse.tycho.p2.impl.publisher.AbstractSiteDependenciesAction.createSiteVersion(String) should be
"format(n[.n=0;[.n=0;]]['-'S])"

Original:
} catch (IllegalArgumentException e) {
// treat as raw otherwise
            return Version.create("format(n[.n=0;[.n=0;['-'S]]]):" + version);
}

'mvn package' using a pom.xml with <version>1.0-SNAPSHOT</version> and <packaging>eclipse-repository</packaging> generates

[ERROR] Internal error: java.lang.IllegalArgumentException: Format "format(n[.n=0;[.n=0;[-S]]])" was unable to parse 1.0-SNAPSHOT -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalArgumentException: Format "format(n[.n=0;[.n=0;[-S]]])" was unable to parse 1.0-SNAPSHOT
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.IllegalArgumentException: Format "format(n[.n=0;[.n=0;[-S]]])" was unable to parse 1.0-SNAPSHOT
	at org.eclipse.equinox.internal.p2.metadata.VersionFormat.parse(VersionFormat.java:275)
	at org.eclipse.equinox.internal.p2.metadata.VersionParser.parse(VersionParser.java:177)
	at org.eclipse.equinox.p2.metadata.Version.create(Version.java:79)
	at org.eclipse.tycho.p2.impl.publisher.AbstractSiteDependenciesAction.createSiteVersion(AbstractSiteDependenciesAction.java:109)
	at org.eclipse.tycho.p2.impl.publisher.AbstractSiteDependenciesAction.getVersion(AbstractSiteDependenciesAction.java:100)
	at org.eclipse.tycho.p2.impl.publisher.AbstractDependenciesAction.perform(AbstractDependenciesAction.java:79)
	at org.eclipse.equinox.p2.publisher.Publisher$ArtifactProcess.run(Publisher.java:207)
	at org.eclipse.equinox.p2.publisher.Publisher.publish(Publisher.java:237)
	at org.eclipse.tycho.p2.impl.publisher.AbstractMetadataGenerator.publish(AbstractMetadataGenerator.java:122)
	at org.eclipse.tycho.p2.impl.publisher.AbstractMetadataGenerator.generateMetadata(AbstractMetadataGenerator.java:58)
	at org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator.generateMetadata(DefaultDependencyMetadataGenerator.java:31)
	at org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator.generateMetadata(DefaultDependencyMetadataGenerator.java:1)
	at org.eclipse.tycho.p2.resolver.P2DependencyResolver.getDependencyMetadata(P2DependencyResolver.java:147)
	at org.eclipse.tycho.p2.resolver.P2DependencyResolver.setupProjects(P2DependencyResolver.java:130)
	at org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject(DefaultTychoResolver.java:96)
	at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:90)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:266)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	... 11 more
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
Comment 3 Mickael Istria CLA 2021-04-08 18:04:12 EDT
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present when latest release:
* Create a new issue at https://github.com/eclipse/tycho/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.