Failed to execute goal org.eclipse.tycho:tycho-apitools-plugin:5.0.0-SNAPSHOT:verify
Following up on https://github.com/eclipse-platform/eclipse.platform.swt/pull/2269#issuecomment-3008713939
Description I've seen the following error a couple of times in the past few days, almost consistently in PRs in SWT (it might happen in other repos too, I just remember SWT because it's what I'm working on these days):
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-apitools-plugin:5.0.0-SNAPSHOT:verify (verify) on project org.eclipse.swt.gtk.linux.ppc64le: Execute ApiApplication failed: InvocationTargetException: Cannot invoke "org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent.getSymbolicName()" because "component" is null -> [Help 1]
Here's a complete stack trace:
Stack trace
00:05:53.938 [ERROR] Failed to execute goal org.eclipse.tycho:tycho-apitools-plugin:5.0.0-SNAPSHOT:verify (verify) on project org.eclipse.swt.gtk.linux.ppc64le: Execute ApiApplication failed: InvocationTargetException: Cannot invoke "org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent.getSymbolicName()" because "component" is null -> [Help 1]
00:05:53.938 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-apitools-plugin:5.0.0-SNAPSHOT:verify (verify) on project org.eclipse.swt.gtk.linux.ppc64le: Execute ApiApplication failed
00:05:53.938 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
00:05:53.938 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
00:05:53.938 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
00:05:53.939 at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
00:05:53.939 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
00:05:53.939 at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
00:05:53.939 at java.util.concurrent.FutureTask.run (FutureTask.java:317)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
00:05:53.939 at java.lang.Thread.run (Thread.java:1583)
00:05:53.939 Caused by: org.apache.maven.plugin.MojoExecutionException: Execute ApiApplication failed
00:05:53.939 at org.eclipse.tycho.apitools.ApiAnalysisMojo.performAnalysis (ApiAnalysisMojo.java:321)
00:05:53.939 at org.eclipse.tycho.apitools.ApiAnalysisMojo.execute (ApiAnalysisMojo.java:217)
00:05:53.939 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
00:05:53.939 at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
00:05:53.939 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
00:05:53.939 at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
00:05:53.939 at java.util.concurrent.FutureTask.run (FutureTask.java:317)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
00:05:53.939 at java.lang.Thread.run (Thread.java:1583)
00:05:53.939 Caused by: java.lang.reflect.InvocationTargetException
00:05:53.939 at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:115)
00:05:53.939 at java.lang.reflect.Method.invoke (Method.java:580)
00:05:53.939 at org.eclipse.tycho.osgi.framework.EclipseFramework.execute (EclipseFramework.java:170)
00:05:53.939 at org.eclipse.tycho.apitools.ApiAnalysisMojo.performAnalysis (ApiAnalysisMojo.java:319)
00:05:53.939 at org.eclipse.tycho.apitools.ApiAnalysisMojo.execute (ApiAnalysisMojo.java:217)
00:05:53.939 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
00:05:53.939 at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
00:05:53.939 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
00:05:53.939 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
00:05:53.939 at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
00:05:53.939 at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
00:05:53.939 at java.util.concurrent.FutureTask.run (FutureTask.java:317)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
00:05:53.939 at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
00:05:53.939 at java.lang.Thread.run (Thread.java:1583)
00:05:53.939 Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent.getSymbolicName()" because "component" is null
00:05:53.940 at org.eclipse.pde.api.tools.internal.util.Util.getComponentVersionsId (Util.java:2085)
00:05:53.940 at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator$2.visit (ApiComparator.java:695)
00:05:53.940 at org.eclipse.pde.api.tools.internal.model.ArchiveApiTypeContainer.accept (ArchiveApiTypeContainer.java:166)
00:05:53.940 at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.internalCompare (ApiComparator.java:622)
00:05:53.940 at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare (ApiComparator.java:284)
00:05:53.940 at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator.compare (ApiComparator.java:307)
00:05:53.940 at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.checkCompatibility (BaseApiAnalyzer.java:1454)
00:05:53.940 at org.eclipse.pde.api.tools.internal.builder.BaseApiAnalyzer.analyzeComponent (BaseApiAnalyzer.java:273)
00:05:53.940 at org.eclipse.tycho.apitools.ApiAnalysis.performAPIAnalysis (ApiAnalysis.java:253)
00:05:53.940 at org.eclipse.tycho.apitools.ApiAnalysis.runAnalysis (ApiAnalysis.java:231)
00:05:53.940 at org.eclipse.tycho.apitools.ApiAnalysis.call (ApiAnalysis.java:182)
00:05:53.940 at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
00:05:53.940 at java.lang.reflect.Method.invoke (Method.java:580)
00:05:53.940 at org.eclipse.tycho.osgi.framework.EclipseFramework.execute (EclipseFramework.java:170)
00:05:53.940 at org.eclipse.tycho.apitools.ApiAnalysisMojo.performAnalysis (ApiAnalysisMojo.java:319)
00:05:53.940 at org.eclipse.tycho.apitools.ApiAnalysisMojo.execute (ApiAnalysisMojo.java:217)
00:05:53.940 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
00:05:53.940 at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
00:05:53.940 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
00:05:53.940 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
00:05:53.940 at io.takari.maven.builder.smart.SmartBuilderImpl.buildProject (SmartBuilderImpl.java:206)
00:05:53.940 at io.takari.maven.builder.smart.SmartBuilderImpl$ProjectBuildTask.run (SmartBuilderImpl.java:71)
00:05:53.940 at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:572)
00:05:53.940 at java.util.concurrent.FutureTask.run (FutureTask.java:317)
00:05:53.940 at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
00:05:53.940 at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
00:05:53.940 at java.lang.Thread.run (Thread.java:1583)
00:05:53.940 [ERROR]
00:05:53.940 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
00:05:53.940 [ERROR]
00:05:53.940 [ERROR] For more information about the errors and possible solutions, please read the following articles:
00:05:53.940 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
00:05:53.940 [ERROR]
00:05:53.940 [ERROR] After correcting the problems, you can resume the build with the command
00:05:53.940 [ERROR] mvn <args> -rf :org.eclipse.swt.gtk.linux.ppc64le
script returned exit code 1
Additional details In SWT this fails for every platform in each one of the Matrix checks, which is odd because I would expect that e.g. Windows does not try to verify anything that has to do with Linux or viceversa.
Full log Here's a full log: api-analysis-fails.log
Sadly api-tools has numerous bugs and instabilities and no one really cares to investigate/fix/stabilize that because it is working most of the time.
If it is somehow reproducible, one can enable the debug flag for such builds to get some more output, it is mostly some kind of other job running, a download failure or simple timing issue.
Because of this we even retry a failed analysis up to five times but in this case not the analysis fails but it runt into a runtime error. If it would report some kind of proper error it could be marked as recoverable and hopefully working on the next run.
I added 2 parameters to the mvn execution (-Ddebug=true and -X) but I wasn't able to find any useful error in the debug output. I think I put -Ddebug in the wrong place because I don't see any difference with/without it.
Can you give me a hint? Where should the parameter(s) go?
Also, I noticed that the error only happens when deleting the classes MonitorAwarePoint and MonitorAwareRectangle. If I deprecate them instead of deleting them, no exceptions are thrown.
The user property is -Dtycho.apitools.debug=true, do you see the same error when you run the build locally (use -Papi-check to enable APi tools)? Does it happen on Github only or also on Jenkins?
Some insights on this I had when digging a bit into the issue: the failure is easily reproducible locally. As the stack trace indicates, it is failing here:
at org.eclipse.pde.api.tools.internal.util.Util.getComponentVersionsId (Util.java:2085)
at org.eclipse.pde.api.tools.internal.provisional.comparator.ApiComparator$2.visit (ApiComparator.java:695)
This happens when comparing the SWT fragment with a removed class against the baseline. Interestingly, in the code shown above component2.getHost() is null even though component2.isFragment() is true, which violates the method's contract. The BundleComponent implementation is the only I found with isFragment() returning false:
https://github.com/eclipse-pde/eclipse.pde/blob/aa2d0446d31b9f04dbb3b620b06da849c275d2c1/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java#L1008-L1021
From my understanding, it must be this line violating the contract by unexpectedly returning null: https://github.com/eclipse-pde/eclipse.pde/blob/aa2d0446d31b9f04dbb3b620b06da849c275d2c1/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java#L1018
return getBaseline().getApiComponent(host.getName());