-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Airgap] maven could not calculate build plan - settings.xml not used #14857
Comments
Memory issue? |
I tested the project and wasn't able to reproduce the issue. |
devfile might help |
I guess my environment is behind the firewall, so that I copy settings.xml (contains the proxy settings) to /home/users/.m2 fold. How do I do in the devfile? |
@rbcminghou |
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.8.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.8.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.8.1 from/to central (https://repo.maven.apache.org/maven2): Connection reset |
well, there's your reason: you're behind a firewall and can't see repo.maven.apache.org/maven2. Can you set up settings.xml to redirect requests for maven central to your internal copy? |
The "settings.xml" file must be stored in /home/user/.m2 and that is where Maven picks up by default. |
so if you're using a settings.xml with an override for maven central -> internal nexus... then why is your build trying to go to MC directly? Are you doing this commandline in console, or via a command? If the latter, seems like the issue is that the maven runtime container (or sidecar?) isn't respecting the settings.xml file in the user's workspace, and is instead defaulting to normal "on the internet where Maven Central is accessible" behaviour, rather than the air-gapped, settings.xml-overridden scenario. @tolusha Do we need some way to inject it into the rt/sidecar container so that it's seen and used? cc: @l0rd |
I think settings.xml is used for Maven widely.... there is not just set for proxy but for other purposes also. I think if Eclipse che wants to abandon the support of usage settings.xml and I am not sure the Maven users are okay with it. |
@fbricon |
Latest from Ming suggests that the complete workaround is to add a command/action/task that does:
Since a user might have a different settings.xml file in each project in his workspace, this might be an acceptable, safe solution. Could also configure the Alternatively, we could set up some logic that says "if devfile only includes one project, and that project includes a settings.xml in the root of But that might accidentally overwrite/destroy something the user manually set up, so the above solution (and some Che 7 doc on how to use maven in airgap) might be the best approach. |
I am wondering that the custom resource YAML proxy settings (following lines) can help?! # protocol+hostname of a proxy server. Automatically added as JAVA_OPTS and https(s)_proxy # to Che server and workspaces containers proxyURL: '' # port of a proxy server proxyPort: '' # username for a proxy server proxyUser: '' # password for a proxy user proxyPassword: '' # a list of non-proxy hosts. Use | as delimiter, eg localhost|my.host.com|123.42.12.32 nonProxyHosts: '' |
I don't think setting up settings.xml in the dev machine container's |
It could also potentially be done by mounting a configmap containing the proper settings.xml as a volume in the workspace pod, though I haven't tested that sort of flow directly. |
@amisevsk it is not obvious to me how mounting a config map would work for this. To meet user expectations, we need settings.xml to be a regular file that can be changed by the user. |
@tsmaeder in #14391 I mentioned the approach to:
This approach wasn't possible at the time you fixed #14391 but now you can define plugins init containers and platform team should address #14343 during this sprint. Would that work? @amisevsk it's not clear to me how configmaps would help, maybe in conjunction with an init container? |
The use case I was imagining would be a user of Che configuring the server side to work with their internal repositories; if the settings.xml needs to be modifiable, then this doesn't work, but, if the use case is "paste the settings.xml you want to use here", then it could be created as a configmap and mounted as an overlay. The issue with init containers is that it can end up being a long queue of containers that need to be pulled and started, all for a simple "copy this file to this location". |
This remains a problem for our airgap customer with CRW 2.0.1 (on OCP 3.11 deployed via crwctl). His current workaround is a custom devfile which does this to override default maven-java devfile actions, w/ his
|
Here's what I don't understand: the ~/.m2 folder should be persistent anyway....why doesn't putting settings.xml there work? |
There is a script here (https://github.com/che-dockerfiles/che-sidecar-java/blob/11/etc/before-start.sh) that takes the env-variable $MAVEN_MIRROR_URL and puts it into settings.xml. Does that help? |
I am encountering the similar issue. Currently, I resolved it by creating a manual settings.xml with the mirrored Nexus info in .m2 folder through Che/CRW maven terminal window. Nick's suggestion seems to automate somewhat. But ideally, there should be a property through CheCluster that should be able to automate this somewhat or a command option built inside Che/CRW through setting. |
The trouble with init containers is that they can only write to shared volumes, so pre-populating ~/.m2 with mirrored artifacts would not work in that use case. On the other hand, we don't really want to have special base images for every technologies. |
@tsmaeder This is likely a hole in my understanding, but I'm not clear what you mean -- currently, I believe volumes in a pod are already shared by default (i.e. my java-maven workspace mounts the |
@amisevsk I was referring to the case where a container wants to bring a pre-populated ~/.m2 folder. Share volumes in a workspace are always empty at workspace creation. |
Ah right, that makes sense. I misunderstood the context. |
FYI this is turning into a more pressing issue as more customers are asking for this feature. |
@sunix no, having environment variables does not help here: we need to automatically create a config file to make this work out of the box. |
Do we have an ETA for this to be solved? It would be cool if it could be moved out of backlog and into a specific milestone, such as 7.12 (ideal) or 7.13 (less ideal). |
Isn't this covered in the docs, or is this a different issue? |
I am running che 7.2.0 and the environment information:
mvn --version
Picked up JAVA_TOOL_OPTIONS: -XX:MaxRAMPercentage=50 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xms20m -Djava.security.egd=file:/dev/./urandom
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)
Maven home: /usr/share/maven
Java version: 11.0.3, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.5.1.el7.x86_64", arch: "amd64", family: "unix"
Any suggestion?
The text was updated successfully, but these errors were encountered: