JetBrains / Qodana

📝 Source repository of Qodana Help
https://www.jetbrains.com/help/qodana
Apache License 2.0
392 stars 67 forks source link

HTTP proxy support #24

Closed xasx closed 3 years ago

xasx commented 3 years ago

I am behind a corporate proxy and need Qodana to talk to it for internet access.

Opening project...[INFO] Validation error:
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.3.3.RELEASE from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/org/springframework/boot/spring-boot-dependencies/2.3.3.RELEASE/spring-boot-dependencies-2.3.3.RELEASE.pom[ERROR] Maven server structure problem
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact org.springframework.boot:spring-boot-dependencies:pom:2.3.3.RELEASE from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/org/springframework/boot/spring-boot-dependencies/2.3.3.RELEASE/spring-boot-dependencies-2.3.3.RELEASE.pom[INFO] Validation error:
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.11.0 from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/com/fasterxml/jackson/jackson-bom/2.11.0/jackson-bom-2.11.0.pom[ERROR] Maven server structure problem
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact com.fasterxml.jackson:jackson-bom:pom:2.11.0 from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/com/fasterxml/jackson/jackson-bom/2.11.0/jackson-bom-2.11.0.pom[INFO] Validation error:
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact org.glassfish.jersey:jersey-bom:pom:2.26-b03 from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/org/glassfish/jersey/jersey-bom/2.26-b03/jersey-bom-2.26-b03.pom[ERROR] Maven server structure problem
[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact org.glassfish.jersey:jersey-bom:pom:2.26-b03 from/to cache-central (https://cache-redirector.jetbrains.com/maven-central): Transfer failed for https://cache-redirector.jetbrains.com/maven-central/org/glassfish/jersey/jersey-bom/2.26-b03/jersey-bom-2.26-b03.pom[INFO] Validation error:
[ERROR] org.apache.maven.artifact.InvalidArtifactRTException: For artifact {commons-codec:commons-codec:null:jar}: The version cannot be empty.[ERROR] Maven server structure problem
[ERROR] org.apache.maven.artifact.InvalidArtifactRTException: For artifact {commons-codec:commons-codec:null:jar}: The version cannot be empty.done.

How to do that? Thanks.

sepich commented 3 years ago

Have you tried the usual way of passing HTTP_PROXY env variable to container? I.e. start qodana like that: docker run -e HTTP_PROXY=your.proxy.addr:3128 -e HTTPS_PROXY=your.proxy.addr:3128 ...

xasx commented 3 years ago

Yes, these are not respected.

I am going to try passing the -D proxy properties to idea64.vmoptions

xasx commented 3 years ago

Using gitlab ci, this did the trick to pick up the proxy env vars:

  script:
    - echo '-Djava.net.useSystemProxies=true' >> /opt/idea/bin/idea64.vmoptions
    - /opt/idea/bin/entrypoint --results-dir=$CI_PROJECT_DIR/qodana --save-report --report-dir=$CI_PROJECT_DIR/qodana/report
sepich commented 3 years ago

Thank you for providing feedback and snippet of the solution! This issue would also help others. Just a note that it is possible to pass java -D options also via env _JAVA_OPTIONS or IDE_PROPERTIES_PROPERTY: https://github.com/JetBrains/Qodana/blob/main/Docker/techs.md#configuring