eclipse-tycho / tycho

Tycho project repository (tycho)
https://tycho.eclipseprojects.io
Eclipse Public License 2.0
170 stars 189 forks source link

[regression] tycho-buildtimestamp-jgit impact with pomDependencies=consider #1377

Closed briandealwis closed 2 years ago

briandealwis commented 2 years ago

I've hit a subtle bug in Tycho that was introduced in 2.7.0 and is present in 3.0.0-SNAPSHOT.

Basically a project that:

I've created an demonstration project in https://github.com/briandealwis/tycho/tree/jgit-buildtimestamp-bug/tycho-its/projects/pomDependencyConsider.buildtimestamp.jgit

$ mvn package -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] No explicit target runtime environment configuration. Build is platform dependent.
[INFO] ### Using TychoRepositoryTransport for remote P2 access (You can disable this with -Dtycho.p2.transport=ecf) ###
[INFO]     Cache location:         /usr/local/google/home/bdealwis/.m2/repository/.cache/tycho
[INFO]     Transport mode:         online
[INFO]     Update mode:            cache first
[INFO]     Minimum cache duration: 60 minutes
[INFO]       (you can configure this with -Dtycho.p2.transport.min-cache-minutes=<desired minimum cache duration>)
[INFO] Resolving dependencies of MavenProject: pomDependencyConsider.buildtimestamp.jgit:feature:0.0.1-SNAPSHOT @ /usr/local/google/home/bdealwis/Projects/CTE/repo-tycho/tycho-its/projects/pomDependencyConsider.buildtimestamp.jgit/feature/pom.xml
[INFO] The following requirements are not satisfied yet and must be provided through pom dependencies:
[INFO]    - org.eclipse.equinox.p2.iu; com.google.guava 0.0.0
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] parent                                                             [pom]
[INFO] feature                                                [eclipse-feature]
[INFO] 
[INFO] ----------< pomDependencyConsider.buildtimestamp.jgit:parent >----------
[INFO] Building parent 0.0.1-SNAPSHOT                                     [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] ---------< pomDependencyConsider.buildtimestamp.jgit:feature >----------
[INFO] Building feature 0.0.1-SNAPSHOT                                    [2/2]
[INFO] --------------------------[ eclipse-feature ]---------------------------
[INFO] 
[INFO] --- tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator (default-build-qualifier-aggregator) @ feature ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for parent 0.0.1-SNAPSHOT:
[INFO] 
[INFO] parent ............................................. SUCCESS [  0.002 s]
[INFO] feature ............................................ FAILURE [  0.905 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.077 s
[INFO] Finished at: 2022-09-20T16:25:23Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator (default-build-qualifier-aggregator) on project feature: Execution default-build-qualifier-aggregator of goal org.eclipse.tycho:tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator failed: Could not resolve plugin com.google.guava_0.0.0; Path to dependency:
[ERROR] 
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator (default-build-qualifier-aggregator) on project feature: Execution default-build-qualifier-aggregator of goal org.eclipse.tycho:tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator failed: Could not resolve plugin com.google.guava_0.0.0; Path to dependency:

    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-build-qualifier-aggregator of goal org.eclipse.tycho:tycho-packaging-plugin:3.0.0-SNAPSHOT:build-qualifier-aggregator failed: Could not resolve plugin com.google.guava_0.0.0; Path to dependency:

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.RuntimeException: Could not resolve plugin com.google.guava_0.0.0; Path to dependency:

    at org.eclipse.tycho.core.ArtifactDependencyVisitor.newRuntimeException (ArtifactDependencyVisitor.java:44)
    at org.eclipse.tycho.core.ArtifactDependencyVisitor.missingPlugin (ArtifactDependencyVisitor.java:35)
    at org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker.traversePlugin (AbstractArtifactDependencyWalker.java:222)
    at org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker.traverseFeature (AbstractArtifactDependencyWalker.java:92)
    at org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker.traverseFeature (AbstractArtifactDependencyWalker.java:69)
    at org.eclipse.tycho.core.osgitools.EclipseFeatureProject$1.walk (EclipseFeatureProject.java:41)
    at org.eclipse.tycho.buildversion.BuildQualifierAggregatorMojo.getBuildTimestamp (BuildQualifierAggregatorMojo.java:77)
    at org.eclipse.tycho.buildversion.BuildQualifierMojo.getDesiredQualifier (BuildQualifierMojo.java:170)
    at org.eclipse.tycho.buildversion.BuildQualifierMojo.calculateQualifiedVersion (BuildQualifierMojo.java:149)
    at org.eclipse.tycho.buildversion.BuildQualifierMojo.execute (BuildQualifierMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
akurtakov commented 2 years ago

Why "demonstration fails using Tycho 2.7.5 with tycho-buildtimestamp-jgit 2.6.0" ? Tycho components are not supposed to mix versions.

briandealwis commented 2 years ago

I initially thought it was a problem in the jgit timestamp provider itself. I knew the problem didn’t occur in Tycho 2.6.0 so I thought I’d try the 2.6.0 provider in 2.7.5 (there didn’t look to be many changes).

laeubi commented 2 years ago

@briandealwis thanks for the example, do you think you can transform this into an integration-test to demonstrate the issue and propose a PR for the new test-case?

briandealwis commented 2 years ago

I used git bisect and found the problem commit is 1609a1a80083ca54f8074e9181686b09007c17b9 (PR #470). Unfortunately this is beyond my knowledge of Tycho. I've turned the problem project into an integration test at https://github.com/briandealwis/tycho/tree/jgit-buildtimestamp-bug/

laeubi commented 2 years ago

I've turned the problem project into an integration test at https://github.com/briandealwis/tycho/tree/jgit-buildtimestamp-bug/

Can you rebase this on current master and then open a Pullrequest?

briandealwis commented 2 years ago

@laeubi opened #1400.

laeubi commented 2 years ago

The issue is that the (full) target platform is (not yet) computed at this phase, but the error only occurs with a custom build-timestamp provider, that's why this was not detected earlier.