Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
briandealwis opened this issue Sep 20, 2022 · 7 comments · Fixed by #1405
Closed

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

briandealwis opened this issue Sep 20, 2022 · 7 comments · Fixed by #1405
Labels
🚨 regression Regression compared to previous release - blocks upcoming release and other merges
Milestone

Comments

@briandealwis
Copy link
Contributor

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:

  • uses pomDependencies=consider,
  • uses the tycho-buildtimestamp-jgit provider
  • includes a Maven dependency with OSGi metadata, like Guava,
  • and has a feature that includes this Maven dependency
    will fail with a resolving error on the Maven dependency.

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

  • the demonstration works fine with Tycho 2.6.0
  • the demonstration fails using Tycho 2.7.5 with tycho-buildtimestamp-jgit 2.6.0
$ 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
Copy link
Member

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

@briandealwis
Copy link
Contributor Author

briandealwis commented Sep 20, 2022

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).

briandealwis added a commit to GoogleCloudPlatform/google-cloud-eclipse that referenced this issue Sep 20, 2022
- update to Tycho 2.7.5, which includes lifecycle-mapping definitions
  and avoids the need for the now-defunct tycho configurator

- configure the c.g.c.t.e.googleapis copy-dependencies to be
  executed on workspace change, and avoid the need for the
  maven-dependency-plugin configurator

- disable the use of the tycho-buildtimestamp-jgit provider
  specifically for features/c.g.c.t.e.3rdparty.feature to work
  around eclipse-tycho/tycho#1377
@laeubi
Copy link
Member

laeubi commented Sep 20, 2022

@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
Copy link
Contributor Author

I used git bisect and found the problem commit is 1609a1a (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
Copy link
Member

laeubi commented Sep 21, 2022

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
Copy link
Contributor Author

@laeubi opened #1400.

elefeint pushed a commit to GoogleCloudPlatform/google-cloud-eclipse that referenced this issue Sep 21, 2022
* chore: enable building in latest Eclipse

- update to Tycho 2.7.5, which includes lifecycle-mapping definitions
  and avoids the need for the now-defunct tycho configurator

- configure the c.g.c.t.e.googleapis copy-dependencies to be
  executed on workspace change, and avoid the need for the
  maven-dependency-plugin configurator

- disable the use of the tycho-buildtimestamp-jgit provider
  specifically for features/c.g.c.t.e.3rdparty.feature to work
  around eclipse-tycho/tycho#1377

* Use Tycho 2.7.x only when loading into Eclipse

Use the `m2e.version` property, set by m2eclipse, to determine
when being used within Eclpse.  Tycho 2.7.4+ includes lifecycle
mapping metadata for the Tycho plugins such that we no longer need
to use the Tycho configurator.  But we continue to use Tycho 2.6.0
for builds.
@laeubi laeubi added the 🚨 regression Regression compared to previous release - blocks upcoming release and other merges label Sep 22, 2022
@laeubi laeubi mentioned this issue Sep 22, 2022
29 tasks
@laeubi
Copy link
Member

laeubi commented Sep 22, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 regression Regression compared to previous release - blocks upcoming release and other merges
Projects
None yet
3 participants