Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

Add maven support #5299

Closed
1 task done
rmannibucau opened this issue Jul 18, 2024 · 7 comments · Fixed by #5339
Closed
1 task done

Add maven support #5299

rmannibucau opened this issue Jul 18, 2024 · 7 comments · Fixed by #5339
Assignees
Labels
🚀 feat New feature

Comments

@rmannibucau
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see added?

Hi,

I really like the simplicity to of adding java/dotnet version in PS1, in my custom PS1 I was used to add maven version too (if there is a pom.xml in the folder), is it possible to add it (parsing mvn --version)?

@rmannibucau
Copy link
Author

If i'm not wrong it only does an exec which is fine but would it be possible to either cache it (with the env as key?) or read it from $MAVEN_HOME/lib/maven-core-${version}.jar if MAVEN_HOME exists - an alternative with the same spirit is to detect where mvn binary is from the PATH/Path then go up to find back lib folder (in path $MAVEN_HOME/bin is added generally).
If this heuristic fails, an exec is fine ok I guess - or nothing if it uses a flag like kubectl segment?

@JanDeDobbeleer
Copy link
Owner

@rmannibucau you can use cache_version out of the box.

@rmannibucau
Copy link
Author

@JanDeDobbeleer I probably misread the code but I didn't see the key being composed of the env - my use case is SDKMan (Chocolatey on windows but it works a bit differently) and a switch of project using different maven (+java) versions and I want OMP to refresh the PS1 without a timeout or alike. SDKMan uses a symb link so the file resolution is more robust but since it sets the version in the env in another var using the env as a key can work too.

@JanDeDobbeleer
Copy link
Owner

@rmannibucau is there a specific env var that contains the version? Or just MAVEN_HOME?

@rmannibucau
Copy link
Author

@JanDeDobbeleer think PATH or MAVEN_HOME is the one, default will point to the symb link but if auto_env is enabled both are updated to preppend the "local" location so should be sufficient - I don't have a windows computer for some weeks to test chocolatey but hope it is close.

Side note: open question, what about invalidating the whole cache if anything in the env changes? Should be sufficient and more generic no?

@JanDeDobbeleer
Copy link
Owner

@rmannibucau that's possible, but we can also just validate that MAVEN_HOME changed rather than cache the entire env. Regardless, it's an enhancement as this wasn't requested in the message above (but can be done).

@rmannibucau
Copy link
Author

@JanDeDobbeleer agree it is another ticket, just mentionning it cause using too much exec the prompt becomes unusable very quickly. The fact to only cache the home is more fragile - nothing mentions it is first in the path/the path is not modified without, it is less to validate the path probably.

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

Successfully merging a pull request may close this issue.

2 participants