Community
Participate
Working Groups
Getting NPE when I tried to use tycho 1.0.0 in eclipse build [ERROR] Failed to execute goal org.eclipse.tycho:tycho-versions-plugin:1.0.0:update-pom (default-cli) on project platform-aggregator: Execution default-cli of goal org.eclipse.tycho:tycho-versions-plugin:1.0.0:update-pom failed. NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-versions-plugin:1.0.0:update-pom (default-cli) on project platform-aggregator: Execution default-cli of goal org.eclipse.tycho:tycho-versions-plugin:1.0.0:update-pom failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 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:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 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:498) 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.PluginExecutionException: Execution default-cli of goal org.eclipse.tycho:tycho-versions-plugin:1.0.0:update-pom failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20 more Caused by: java.lang.NullPointerException at org.eclipse.tycho.versions.engine.VersionChange.hashCode(VersionChange.java:56) at java.util.HashMap.hash(HashMap.java:338) at java.util.HashMap.put(HashMap.java:611) at java.util.HashSet.add(HashSet.java:219) at org.eclipse.tycho.versions.engine.VersionsEngine.addVersionChange(VersionsEngine.java:100) at org.eclipse.tycho.versions.engine.PomVersionUpdater.apply(PomVersionUpdater.java:107) at org.eclipse.tycho.versions.UpdatePomMojo.execute(UpdatePomMojo.java:38) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 21 more
I debugged into the Tycho Code and the only case this could happen is if you do have an eclipse proudct with a missing version attribute in its .product file. In Tycho 1.0.0 we added support for updating poms for the "eclipse-repository" packaging type (see: Bug: 508293). So I guess that if you are using an older Tycho version it is working because your eclipse prodcut (packaging type "eclipse-repository") is skipped during pom updates but with Tycho 1.0.0 it's trying to update the version of that product pom file. Please check all your .product files for a missing version attribute The version is an attribute of the root xml element in the .product file: <product uid="foo.bar" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="false"> The Bug here is that we should fail the build with an appropriate error message if the version attribute is missing.
Sorry, there is another case. When the .product file could not be found. Tycho assumes, that the .product file does have the name <artifactId>.product. Looking into your code I see that the following product files do not follow that convention: eclipse.platform.releng.tychoeclipsebuilder/platform.sdk/platform.sdk.product eclipse.platform.releng.tychoeclipsebuilder/sdk/sdk.product eclipse.platform.releng.tychoeclipsebuilder/rcp.config/config.product eclipse.platform.releng.tychoeclipsebuilder/equinox.starterkit.product/EclipseRTOSGiStarterKit.product eclipse.platform.releng.tychoeclipsebuilder/platform/platform.product eclipse.platform.releng.tychoeclipsebuilder/rcp/rcp.product eclipse.platform.releng.tychoeclipsebuilder/rcp.sdk/rcp.sdk.product If it's an option for you, rename your product files to match <artifactid>.product. Maybe we must be more flexible when looking up the product file: E.g. first look for a <artifactId>.product file, if it's not there take the first .product file found in that directory and fail if there is no product file there.
New Gerrit change created: https://git.eclipse.org/r/91340
(In reply to Martin Schreiber from comment #2) > Sorry, there is another case. When the .product file could not be found. > Tycho assumes, that the .product file does have the name > <artifactId>.product. > > Looking into your code I see that the following product files do not follow > that convention: > > eclipse.platform.releng.tychoeclipsebuilder/platform.sdk/platform.sdk.product > eclipse.platform.releng.tychoeclipsebuilder/sdk/sdk.product > eclipse.platform.releng.tychoeclipsebuilder/rcp.config/config.product > eclipse.platform.releng.tychoeclipsebuilder/equinox.starterkit.product/ > EclipseRTOSGiStarterKit.product > eclipse.platform.releng.tychoeclipsebuilder/platform/platform.product > eclipse.platform.releng.tychoeclipsebuilder/rcp/rcp.product > eclipse.platform.releng.tychoeclipsebuilder/rcp.sdk/rcp.sdk.product > > If it's an option for you, rename your product files to match > <artifactid>.product. > > Maybe we must be more flexible when looking up the product file: > E.g. first look for a <artifactId>.product file, if it's not there take the > first .product file found in that directory and fail if there is no product > file there. I tried renaming the product files. even after renaming I am still getting the same NPE.
Created attachment 266940 [details] Log with Tycho 1.0.0
Created attachment 266941 [details] Log with Tycho 0.26.0
These logs are generated with .product filenames changed.
The code in 1.0.0 assumes for packaging type "eclipse-repository", that there is a product file named <artifactid>.product, regardles if it is a product or an eclipse update site (="eclipse-repository" packaging type + a category.xml). You do have both scenarios. The product files do have a different name, and now your build is failing because you also have eclipse update sites without a product definition file. This are the update sites that causes the NPE now: eclipse.platform.releng.tychoeclipsebuilder/java9patch47/eclipse.releng.repository.java9patch eclipse.platform.releng.tychoeclipsebuilder/eclipse.platform.repository eclipse.platform.releng.tychoeclipsebuilder/java9patch46/eclipse.releng.repository.java9patch The gerrit change noted above contains a fix for all that cases by: _Skipping version update when no product file could be found (eclipse update site case, because in the category.xml there is no information about a version) _Use the <artifact>.product file if present _Use the *.product file if only one is resent _Skip version update if more than one product files are present If you can't wait for next Tycho release, a dirty workarround might work: The product file is used to extract the version, that will be set in the pom. If you add a <artifactId>.product file into the eclipse update site directories, the POM Updater will be satisfied. The product file could be just with the root element and a version attribute: <product version="4.7.0.qualifier" /> This version will be used to set the version in the pom file.
Gerrit change https://git.eclipse.org/r/91340 was merged to [master]. Commit: http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=c43142bf5087b0ed6931e8b7b3eecc873c0954c3
(In reply to Martin Schreiber from comment #8) > The code in 1.0.0 assumes for packaging type "eclipse-repository", that > there is a product file named <artifactid>.product, regardles if it is a > product or an eclipse update site (="eclipse-repository" packaging type + a > category.xml). > > You do have both scenarios. The product files do have a different name, and > now your build is failing because you also have eclipse update sites without > a product definition file. > > This are the update sites that causes the NPE now: > > eclipse.platform.releng.tychoeclipsebuilder/java9patch47/eclipse.releng. > repository.java9patch > > eclipse.platform.releng.tychoeclipsebuilder/eclipse.platform.repository > > eclipse.platform.releng.tychoeclipsebuilder/java9patch46/eclipse.releng. > repository.java9patch > > > The gerrit change noted above contains a fix for all that cases by: > _Skipping version update when no product file could be found (eclipse update > site case, because in the category.xml there is no information about a > version) > _Use the <artifact>.product file if present > _Use the *.product file if only one is resent > _Skip version update if more than one product files are present > > If you can't wait for next Tycho release, a dirty workarround might work: > The product file is used to extract the version, that will be set in the > pom. > If you add a <artifactId>.product file into the eclipse update site > directories, the POM Updater will be satisfied. > The product file could be just with the root element and a version attribute: > <product version="4.7.0.qualifier" /> > > This version will be used to set the version in the pom file. Please let me know when is the next tycho release. In the mean time is it possible for me to use snapshot version? if yes please let me know
Yes it is possible to use a Tycho Snapshot [1] by adding the snapshot repository into your parent pom. Current Snapshot version: 1.1.0-SNAPSHOT [1] https://wiki.eclipse.org/Getting_Tycho
(In reply to Martin Schreiber from comment #11) > Yes it is possible to use a Tycho Snapshot [1] by adding the snapshot > repository into your parent pom. Current Snapshot version: 1.1.0-SNAPSHOT > > [1] https://wiki.eclipse.org/Getting_Tycho I tried update-pom from snapshot. it is working. I will do a full build with snapshot and update the bug with results
*** Bug 515976 has been marked as a duplicate of this bug. ***