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

Could not resolve dependency with tycho > 2.7.5 #2625

Closed
tivervac opened this issue Jul 17, 2023 · 8 comments · Fixed by #2649
Closed

Could not resolve dependency with tycho > 2.7.5 #2625

tivervac opened this issue Jul 17, 2023 · 8 comments · Fixed by #2649

Comments

@tivervac
Copy link
Contributor

I'm trying to build a target platform with Tycho 3.0.5, but it fails. Without any config changes, this TP builds fine for using Tycho 2.7.5.

The command I'm using is ./mvnw --update-snapshots -Dtycho.disableP2Mirrors=true clean install -f pom-target-2021-03.xml -Dmaven.repo.local=$(pwd)/.repository -X

The error I'm getting is (full stacktrace at the bottom)

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project com.sigasi.hdt.dependencies.feature: Could not resolve dependencies for project com.sigasi.hdt.dependencies:com.sigasi.hdt.dependencies.feature:eclipse-feature:5.3.0-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.xtext:org.eclipse.xtext.purexbase:jar:2.29.0, org.eclipse.xtext:org.eclipse.xtext.purexbase.ide:jar:2.29.0: Could not find artifact org.eclipse.xtext:org.eclipse.xtext.purexbase:jar:2.29.0 in central (https://repo.maven.apache.org/maven2)

True, due to a likely build mistake, org.eclipse.xtext.purexbase:jar:2.29.0 is not available on maven central. 2.28.0 is available and building with that version does work so it seems like Tycho really wants to get the dependency from maven central. However, I don't understand why it wants to do so, my target platform is setup with the following repository

<repository>
	<id>tmf</id>
	<url>https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.29.0</url>
	<layout>p2</layout>
</repository>

And that repository does contain purexbase as expected

image

The reason it's trying to download purexbase (which is never mentioned in our code base) is likely because we include this line in our feature.xml

<includes id="org.eclipse.xtext.sdk" version="2.29.0.qualifier" />

That transitively includes purexbase: https://github.com/eclipse/xtext/blob/main/org.eclipse.xtext.sdk.feature/feature.xml

Running with -X doesn't add much more, except for this odd snippet

[DEBUG] Resolving artifact org.eclipse.xtext:org.eclipse.xtext.purexbase:jar:2.29.0 from [2021-03 (https://download.eclipse.org/releases/2021-03/, p2, disabled), updates-2021-03 (https://download.eclipse.org/eclipse/updates/4.19, p2, disabled), tmf (https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.29.0, p2, disabled), ... , central (https://repo.maven.apache.org/maven2, default, releases)]

What's odd about it is that all the repositories are disabled, if that's the case, of course it won't find the purexbase dependency in the xtext update-site (I've redacted the output for brevity, but the other update sites are also disabled). I have of course not manually disabled the update-sites, and this works fine with Tycho 2.7.5 so I wonder what's going on. Both Tycho 3.0.5 and 4.0.0 fail for the same reason.

Running with 2.7.5 and -X does not mention the disabled repositories, nor where it downloaded the purexbase dependency from.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project com.sigasi.hdt.dependencies.feature: Could not resolve dependencies for project com.sigasi.hdt.dependencies:com.sigasi.hdt.dependencies.feature:eclipse-feature:5.3.0-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.xtext:org.eclipse.xtext.purexbase:jar:2.29.0, org.eclipse.xtext:org.eclipse.xtext.purexbase.ide:jar:2.29.0: Could not find artifact org.eclipse.xtext:org.eclipse.xtext.purexbase:jar:2.29.0 in central (https://repo.maven.apache.org/maven2)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies (LifecycleDependencyResolver.java:245)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies (LifecycleDependencyResolver.java:138)
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved (MojoExecutor.java:369)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:327)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    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)
    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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:47)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:156)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:72)

@laeubi
Copy link
Member

laeubi commented Jul 17, 2023

@tivervac this is not a Tycho error but a Maven error. Tycho injects the (from p2 derived) maven dependencies into the model and Xtext seems to declaring "bad" dependencies there.

@laeubi
Copy link
Member

laeubi commented Jul 17, 2023

@tivervac can you provide an integration-test to demonstrate the issue?

@cdietrich
Copy link
Contributor

See also
xtext/publishing#30
eclipse/xtext#2122

eclipse/xtext-eclipse#1931

@tivervac
Copy link
Contributor Author

@cdietrich Thanks for the info I was unaware you had dealt with the issue as well

@laeubi Done, see my PR #2634

@tivervac
Copy link
Contributor Author

@tivervac this is not a Tycho error but a Maven error. Tycho injects the (from p2 derived) maven dependencies into the model and Xtext seems to declaring "bad" dependencies there.

The reason I believe it to be a Tycho issue is that

  • It works with Tycho 2.7.5, but not 3.0.5
  • Somehow the xtext update-site seems to be ignored starting Tycho 3. AFAIK, Tycho is the one hooking p2 update-sites into the maven dependency resolution system

@laeubi
Copy link
Member

laeubi commented Jul 18, 2023

As said Xtext is publishing from P2 data and Tycho is just reading that data and acts on it, Tycho 2.7.5 does not support this feature so it is not affected. Also the Updatesite is not ignored, the error is issued by maven because it reads the data injected by Tycho and this data is wrong and Maven itself does not know anything about update-sites.

@tivervac
Copy link
Contributor Author

I'm afraid I don't understand your reply.

Which new Tycho 3 feature are you referring to? I had a look at the release notes and the closest thing to what you said that I found is Improved P2 transport for more efficiently http-cache handling and improved offline mode. As such, I tried using -Dtycho.p2.transport=ecf but that gives the same failing build.

I also saw New option to transform P2 dependencies into real maven coordinates but I don't have this option enabled.

Having read the linked issues, the below screenshot is the actual issue, and the issue is on the xtext side, right?

As we as a company will be stuck with this Xtext version for a while, would having this allow us to use xtext with it's badly generated p2 metadata?

@laeubi
Copy link
Member

laeubi commented Jul 19, 2023

Having read the linked issues, the below screenshot is the actual issue, and the issue is on the xtext side, right?

Yes this is the actual issue, if it contains data that is not really present it fails to build the consuming project.

As we as a company will be stuck with #1664 Xtext version for a while, would having this allow us to use xtext with it's badly generated p2 metadata?

Yes I described some ideas there, if this is crucial to your business and likes to speed up the development in that area a sponsoring would allow me to assign more time-slots or you can contact me for a contract of fixing a specific Tycho issue and driving a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants