HubSpot / prettier-maven-plugin

Apache License 2.0
116 stars 23 forks source link

Downloading from nodejs.org is blocked by firewall #72

Closed andhusa closed 1 year ago

andhusa commented 1 year ago

When I updated to version 0.18, the maven build broke with this error message:

[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.18:write (default) on <project-name>: Error downloading node: Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.18:write (default) on project <project-name>: Error downloading node

I think this is caused by the firewall on the build machine blocking attempted download of nodejs from https://nodejs.org

jhaber commented 1 year ago

As of https://github.com/HubSpot/prettier-maven-plugin/pull/64 the plugin will download node rather than bundling it. If you want to avoid this download, you can supply a node executable yourself and pass the path to the plugin via the <nodePath> configuration parameter (if you want to just use the version of node on your $PATH you can set <nodePath>node</nodePath>

mikaello commented 1 year ago

Many that have an air gapped environment has the possibility to specify proxies with Nexus/Artifactory for https://nodejs.org/dist and NPM registry, including us. Could you provide these as config variables?

Name -D property name Default value Description
nodeRegistry prettier.nodeRegistry https://nodejs.org/dist/ Where to fetch node binary
npmRegistry prettier.npmRegistry https://registry.npmjs.org/ Registry used to fetch prettier-plugin-java
leonardehrenfried commented 1 year ago

I just had this happen to me even though I set a custom node binary:

[INFO] 
[INFO] --- prettier-maven-plugin:0.19:check (default) @ otp ---
[INFO] Using customized nodePath: node
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:57 min
[INFO] Finished at: 2023-03-24T11:39:10Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.19:check (default) on project otp: Error downloading node: timeout -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error: Process completed with exit code 1.

Should this config not skip the download of node?

jaredstehler commented 1 year ago

Should this config not skip the download of node?

@leonardehrenfried i believe you need to specify both nodePath and npmPath to skip the downloading. see: https://github.com/HubSpot/prettier-maven-plugin/blob/548539ffd753820fa57639443af2362a8246995b/prettier-maven-plugin/src/main/java/com/hubspot/maven/plugins/prettier/PrettierArgs.java#L97-L100