eclipse-tycho / tycho

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

Build with tycho deletes proxy user credentials in Eclipse #4129

Open SebasHein opened 3 months ago

SebasHein commented 3 months ago

I have a weird problem I was not able to solve (nor am I be near to find the root cause of this)

Every time I start a build with maven tycho - tycho shows an error message (see below for full stack tracke "Unable to locate secure storage module". Afterwards it compiles without error (with downloading target platform stuff from internet). The problem is: afterwards every eclipse instance I have has a deleted secure storage.

I use maven 3.8.6, tycho 3.0.4, Java 17 and an different eclipse versions (ranging from somewhat 2022 to 2023-09). Yes I know these are not the latest releases but changeing the environment for several projekts is a rather huge task. I am behind a company proxy - that's the main reason why I need the proxy settings to be set within the eclipse. It's not located to something I specifically did - my colleagues suffer of the same issue.

I tried to search with google (of course) and had a rough look at the issues contained in this project - but I found nothing helpful.

What is also maybe worth to mention is, that during a maven build without usage of tycho everything runs fine (maven per se should not be aware of eclipse stuff so thats in general no surprise).

First question is if this is a known problem that is solved in later versions of tycho? If so please just mention it, take my appologies for bothering you and close the issue. If not: maybe we can dig further and find the root cause of this. I am willing to help and to provide any information you maybe need.

[ERROR] [8291c992-bae0-45c3-870c-c853460a03b2][extension>org.eclipse.tycho:tycho-maven-plugin:3.0.4] Unable to locate secure storage module (org.eclipse.equinox.security.windowspasswordprovider64bit). org.eclipse.equinox.security.storage.StorageException: Unable to locate secure storage module (org.eclipse.equinox.security.windowspasswordprovider64bit). at org.eclipse.equinox.internal.security.storage.PasswordProviderSelector.findStorageModule (PasswordProviderSelector.java:215) at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getModulePassword (SecurePreferencesRoot.java:227) at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getPassword (SecurePreferencesRoot.java:220) at org.eclipse.equinox.internal.security.storage.SecurePreferences.get (SecurePreferences.java:267) at org.eclipse.equinox.internal.security.storage.SecurePreferencesWrapper.get (SecurePreferencesWrapper.java:123) at org.eclipse.core.internal.net.ProxyType.loadProxyAuth (ProxyType.java:559) at org.eclipse.core.internal.net.ProxyType.createProxyData (ProxyType.java:145) at org.eclipse.core.internal.net.ProxyType.getProxyData (ProxyType.java:134) at org.eclipse.core.internal.net.PreferenceManager.migrateInstanceScopePreferences (PreferenceManager.java:287) at org.eclipse.core.internal.net.PreferenceManager.migrate (PreferenceManager.java:256) at org.eclipse.core.internal.net.ProxyManager.checkMigrated (ProxyManager.java:386) at org.eclipse.core.internal.net.ProxyManager.initialize (ProxyManager.java:258) at org.eclipse.core.internal.net.Activator.start (Activator.java:177) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run (BundleContextImpl.java:818) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run (BundleContextImpl.java:1) at java.security.AccessController.doPrivileged (AccessController.java:569) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator (BundleContextImpl.java:810) at org.eclipse.osgi.internal.framework.BundleContextImpl.start (BundleContextImpl.java:767) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0 (EquinoxBundle.java:1032) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker (EquinoxBundle.java:371) at org.eclipse.osgi.container.Module.doStart (Module.java:605) at org.eclipse.osgi.container.Module.start (Module.java:468) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run (ModuleContainer.java:1852) at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute (EquinoxContainerAdaptor.java:136) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel (ModuleContainer.java:1845) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel (ModuleContainer.java:1788) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel (ModuleContainer.java:1750) at org.eclipse.osgi.container.SystemModule.startWorker (SystemModule.java:269) at org.eclipse.osgi.container.Module.doStart (Module.java:605) at org.eclipse.osgi.container.Module.start (Module.java:468) at org.eclipse.osgi.container.SystemModule.start (SystemModule.java:193) at org.eclipse.osgi.internal.framework.EquinoxBundle.start (EquinoxBundle.java:445) at org.eclipse.osgi.internal.framework.EquinoxBundle.start (EquinoxBundle.java:464) at org.eclipse.osgi.launch.Equinox.start (Equinox.java:139) at org.eclipse.sisu.osgi.connect.PlexusFrameworkConnectServiceFactory.getFramework (PlexusFrameworkConnectServiceFactory.java:150) at org.eclipse.sisu.osgi.connect.PlexusFrameworkConnectServiceFactory.locateClass (PlexusFrameworkConnectServiceFactory.java:368) at org.eclipse.sisu.osgi.connect.PlexusFrameworkConnectServiceFactory.getService (PlexusFrameworkConnectServiceFactory.java:352) at org.eclipse.tycho.osgi.TychoServiceFactory.getService (TychoServiceFactory.java:32) at org.eclipse.tycho.p2.resolver.P2DependencyResolver.initialize (P2DependencyResolver.java:497) at org.eclipse.sisu.plexus.PlexusLifecycleManager.initialize (PlexusLifecycleManager.java:303) at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate (PlexusLifecycleManager.java:207) at org.eclipse.sisu.bean.BeanScheduler.schedule (BeanScheduler.java:151) at org.eclipse.sisu.plexus.PlexusLifecycleManager.manage (PlexusLifecycleManager.java:147) at org.eclipse.sisu.plexus.PlexusBeanBinder.afterInjection (PlexusBeanBinder.java:72) at com.google.inject.internal.MembersInjectorImpl.notifyListeners (MembersInjectorImpl.java:131) at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:125) at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32) at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:98) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127) at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66) at com.google.inject.internal.ConstructorInjector.construct (ConstructorInjector.java:93) at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:306) at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050) at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086) at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48) at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85) at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57) at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112) at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127) at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66) at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61) at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47) at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050) at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162) at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81) at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51) at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263) at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255) at org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory.lookupDependencyResolver (DefaultDependencyResolverFactory.java:66) at org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory.lookupDependencyResolver (DefaultDependencyResolverFactory.java:43) at org.eclipse.tycho.core.resolver.DefaultTychoResolver.setupProject (DefaultTychoResolver.java:109) at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:139) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:253) 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)

laeubi commented 3 months ago

Tycho 3 is EOL, so unless you plan to contribute/fund a fix and release I suggest you update to Tycho 4 that no longer uses Eclipse Proxy Service anymore.

SebasHein commented 1 month ago

I tried to do so and used tycho 4.0.9 together with maven 3.9.8.

Within settings.xml I created both a http and https proxy section. Downloads from central are working fine - e.g.:

[INFO] Tycho Version: 4.0.9 (e901909e7aca41ff9559068fb8dde28ba9f266d7) [INFO] Tycho Mode: extension [INFO] Tycho Builder: maven [INFO] Build Threads: 1 Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/build-helper-maven-plugin/maven-metadata.xml (946 B at 13 kB/s) Downloading from central: https://repo.maven.apache.org/maven2/org/eclipse/tycho/tycho-compiler-plugin/4.0.9/tycho-compiler-plugin-4.0.9.pom

But as resolving target definition file starts [INFO] ### Using TychoRepositoryTransport for remote P2 access ### [INFO] Cache location: C:\Users\user.m2\repository.cache\tycho [INFO] Transport mode: online [INFO] Http Transport type: Java11Client [INFO] Update mode: forced [INFO] Minimum cache duration: 60 minutes [INFO] (you can configure this with -Dtycho.p2.transport.min-cache-minutes=) [INFO] Downloading from p2: http://download.eclipse.org/releases/2021-12/p2.index

I get an exception [ERROR] Failed to resolve target definition file: ... Failed to load p2 metadata repository from location http://download.eclipse.org/releases/2021-12: Unable to read repository at http://download.eclipse.org/releases/2021-12. AuthenticationFailedException

Can you suggest where to start investigations why I get this error? I can upload the debug messages (-X -e maven cli parameter output) but since this is a lot of text I wanted to ask first whether that would be helpful.

I looks like it is working in principle - 10 minutes ago with tycho 3.0.5 everything was fine and resolving of target platform without issue.

SebasHein commented 1 week ago

With -X -e maven shows an authentication failed exception.

I found within release notes (https://github.com/eclipse-tycho/tycho/blob/main/RELEASE_NOTES.md) that it is possible to switch back to old custom P2 transport (with -Dtycho.p2.httptransport.type=JavaUrl). It it is working again with this - so the problem is assumed to be somewhere located within new http11 client usage.

It looks like that the username and password given in settings.xml for proxy authentification is read out correct. At least the content within org.eclipse.tycho.p2maven.helper.ProxyHelper at debugging tycho looks good.

Than I found that with -Djdk.http.auth.tunneling.disabledSchemes="" attached the connection through proxy to resolve target definition is working. (see https://stackoverflow.com/questions/53333556/proxy-authentication-with-jdk-11-httpclient or https://www.oracle.com/java/technologies/javase/8u111-relnotes.html)

That means setting environment variable (on windows) JAVA_TOOL_OPTIONS with value -Djdk.http.auth.tunneling.disabledSchemes="" leads to an environment with which tycho 4.0.9 (or 5.0.0-SNAPSHOT) is working again in my environment. Obviously our company proxy requires basic authentication which is disabled per default - see link above. I have not that much experience in implementing the proxy stuff - therefore I cannot tell whether this is a bug or expected behaviour (although it looks much like the latter). Maybe someone can comment on this?

Or is it possible in to add a somehow configurable header in Java11HttpTransportFactory at creating the HttpRequest (line 127)?