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

Maven and Gradle proxy settings not respected for Eclipse[Jdt/Cdt/Groovy] (equo-based steps) #1658

Open
jpraet opened this issue Apr 5, 2023 · 8 comments

Comments

@jpraet
Copy link
Contributor

jpraet commented Apr 5, 2023

Since the upgrade from spotless-maven-plugin 2.34.0 to 2.35.0 I get a "java.net.SocketTimeoutException: Connect timed out" (see full stacktrace below).

It looks like it's not respecting the configured proxy settings in my ~/.m2/settings.xml.

When I manually specify the proxy via the -Dhttps.proxyHost and -Dhttps.proxyPort system properties, it works.

Stacktrace:

[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.35.0:apply (default) on project buildtools: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.35.0:apply failed: java.net.SocketTimeoutException: Connect timed out -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.35.0:apply (default) on project buildtools: Execution default of goal com.diffplug.spotless:spotless-maven-plugin:2.35.0:apply failed: java.net.SocketTimeoutException: Connect timed out
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:347)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    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:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    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 of goal com.diffplug.spotless:spotless-maven-plugin:2.35.0:apply failed: java.net.SocketTimeoutException: Connect timed out
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    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:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    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: java.net.SocketTimeoutException: Connect timed out
    at dev.equo.solstice.p2.Unchecked.wrap (Unchecked.java:25)
    at dev.equo.solstice.p2.P2Model.query (P2Model.java:133)
    at com.diffplug.spotless.extra.EquoBasedStepBuilder.get (EquoBasedStepBuilder.java:88)
    at com.diffplug.spotless.FormatterStepImpl.calculateState (FormatterStepImpl.java:58)
    at com.diffplug.spotless.LazyForwardingEquality.state (LazyForwardingEquality.java:56)
    at com.diffplug.spotless.LazyForwardingEquality.toBytes (LazyForwardingEquality.java:85)
    at com.diffplug.spotless.LazyForwardingEquality.hashCode (LazyForwardingEquality.java:102)
    at java.util.ArrayList.hashCodeRange (ArrayList.java:595)
    at java.util.ArrayList.hashCode (ArrayList.java:582)
    at com.diffplug.spotless.Formatter.hashCode (Formatter.java:276)
    at java.util.HashMap.hash (HashMap.java:338)
    at java.util.HashMap.put (HashMap.java:610)
    at com.diffplug.spotless.maven.FormattersHolder.create (FormattersHolder.java:43)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:220)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    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:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    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.net.SocketTimeoutException: Connect timed out
    at sun.nio.ch.NioSocketImpl.timedFinishConnect (NioSocketImpl.java:546)
    at sun.nio.ch.NioSocketImpl.connect (NioSocketImpl.java:597)
    at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:327)
    at java.net.Socket.connect (Socket.java:633)
    at okhttp3.internal.platform.Platform.connectSocket (Platform.kt:128)
    at okhttp3.internal.connection.RealConnection.connectSocket (RealConnection.kt:295)
    at okhttp3.internal.connection.RealConnection.connect (RealConnection.kt:207)
    at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:226)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106)
    at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74)
    at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255)
    at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154)
    at dev.equo.solstice.p2.P2Client.getBytes (P2Client.java:145)
    at dev.equo.solstice.p2.P2Client.getString (P2Client.java:116)
    at dev.equo.solstice.p2.P2Client$Folder.<init> (P2Client.java:209)
    at dev.equo.solstice.p2.P2Client.addUnits (P2Client.java:94)
    at dev.equo.solstice.p2.P2Session.populateFrom (P2Session.java:34)
    at dev.equo.solstice.p2.P2Model.queryRaw (P2Model.java:96)
    at dev.equo.solstice.p2.P2Model.query (P2Model.java:125)
    at com.diffplug.spotless.extra.EquoBasedStepBuilder.get (EquoBasedStepBuilder.java:88)
    at com.diffplug.spotless.FormatterStepImpl.calculateState (FormatterStepImpl.java:58)
    at com.diffplug.spotless.LazyForwardingEquality.state (LazyForwardingEquality.java:56)
    at com.diffplug.spotless.LazyForwardingEquality.toBytes (LazyForwardingEquality.java:85)
    at com.diffplug.spotless.LazyForwardingEquality.hashCode (LazyForwardingEquality.java:102)
    at java.util.ArrayList.hashCodeRange (ArrayList.java:595)
    at java.util.ArrayList.hashCode (ArrayList.java:582)
    at com.diffplug.spotless.Formatter.hashCode (Formatter.java:276)
    at java.util.HashMap.hash (HashMap.java:338)
    at java.util.HashMap.put (HashMap.java:610)
    at com.diffplug.spotless.maven.FormattersHolder.create (FormattersHolder.java:43)
    at com.diffplug.spotless.maven.AbstractSpotlessMojo.execute (AbstractSpotlessMojo.java:220)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    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:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:827)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:272)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:195)
    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)
@nedtwigg
Copy link
Member

nedtwigg commented Apr 5, 2023

Can you copy-paste the proxy part of your ~/.m2/settings.xml? Obviously replace sensitive info with foo, but include enough so we can have a testcase for parser.

Equo makes its network requests like so:

Not sure how to pass proxy information from your settings.xml through to those clients, we might need to merge a PR into the EquoIDE project too...

@nedtwigg nedtwigg changed the title Maven proxy settings not respected when downloading eclipse equi-ide Maven proxy settings not respected for Eclipse[Jdt/Cdt/Groovy] (equo-based steps) Apr 5, 2023
@jpraet
Copy link
Contributor Author

jpraet commented Apr 6, 2023

    <proxies>
            <proxy>
                    <id>http-proxy</id>
                    <active>true</active>
                    <protocol>http</protocol>
                    <username/>
                    <password/>
                    <host>proxyapp.acme.com</host>
                    <port>8080</port>
                    <nonProxyHosts>localhost|*.acme.inet|10.*.*.*|192.168.*.*</nonProxyHosts>
            </proxy>
    </proxies>

@blacelle
Copy link
Contributor

blacelle commented Apr 7, 2023

Regarding proxy configuration in mvn plugins:

@rdifrango
Copy link

I just ran into the same thing as reported here. Please note in my case, I never had the proxy settings in my settings.xml as the plug-in is honoring my environment variables of HTTP_PROXY, HTTPS_PROXY, and NO_PROXY thus it should continue to do so.

This seems to have been broken since 2.34.0 as I went back to 2.33.0 and it worked just fine.

@nedtwigg
Copy link
Member

@lkoe
Copy link

lkoe commented Nov 3, 2023

Is there any update on this? This blocks us from using the latest spotless version - with additional troubles downstream.

For instance the appears to be an issue when configuring the older spotless version for eslint/prettier with recent versions of those packages. This leads to certain files becoming corrupted during spotless-eslint/prettier.

@rcfja
Copy link

rcfja commented Jan 16, 2024

We are having this issue also at my company.

@nedtwigg nedtwigg changed the title Maven proxy settings not respected for Eclipse[Jdt/Cdt/Groovy] (equo-based steps) Maven and Gradle proxy settings not respected for Eclipse[Jdt/Cdt/Groovy] (equo-based steps) Aug 12, 2024
@blacelle
Copy link
Contributor

mvn users can workaround the issue/configure further the proxy so it is handled by Spotless/EquoIde by:

  1. Rely on a ./.mvn/jvm.config file
  2. Add -Dhttp.proxyHost=my.proxy.host -Dhttp.proxyPort=8080 -Dhttps.proxyHost=my.proxy.host -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts="localhost|127.0.0.1|10.*.*.*|*.example.com|etc"
  3. Ensure these values are consistant with those in settings.xml in <proxy> section

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

No branches or pull requests

6 participants