-
Notifications
You must be signed in to change notification settings - Fork 182
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
Support Maven Wrapper #518
Comments
Related issue: #541 |
Also related to: #503 |
Is there any progress in this? I can't imagine I am the only one using a maven wrapper for my projects instead of globally installing maven everytime |
As a workaround I have created a custom mvnw wrapper file for mvnw itself that first changes directory to the workspace folder like (in the example #!/bin/sh
# Hack needed by redhat.fabric8-analytics extension that runs maven commands from vscode-server binary directory (not from workspace directory)
cd /workspaces/project-folder
/workspaces/project-folder/mvnw "$@" and set the path to that wrapper in NOTE: Also take into account that in latest version (0.7.3) |
I do not have Maven globally installed and I'm getting this error:
So as a workaround I added did this in {
"redHatDependencyAnalytics.mvn.executable.path": "./mvnw"
} But then I got this error:
So as a second workaround I did this: {
"redHatDependencyAnalytics.mvn.executable.path": "%USERPROFILE%\\.m2\\wrapper\\dists\\apache-maven-3.9.5-bin\\32db9c34\\apache-maven-3.9.5\\bin\\mvn"
} Which worked well but now this doesn't work on linux, so as a third workaround I did this: {
"redHatDependencyAnalytics.mvn.executable.path": "$HOME/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5/bin/mvn"
} Which worked well on linux but now this doesn't work on windows. And then I gave up and removed RedHat Dependency Analytics extension. I just have two questions for the project maintainers:
|
@harshrathod50 The problem here is that this extension does not run the mvn commands from the VSCode workspace folder (as most other extensions does and is needed by mvnw to find the .mvn folder). As most of my projects are run using Dev Containers I don't need a "compatible" wrapper for both bash and windows batch but you might try to create one like this. |
Nowadays Maven Wrapper looks like a the facto standard for including maven in your project so you do not need to install maven separately.
Tools like Spring Initializr scaffolds your project with it.
Dependency Analytics should support using the mvnw command out of the box if it is present in the project's folder.
Anyway I tried to set it up manually by setting
maven.executable.path
like:"maven.executable.path": "${fileWorkspaceFolder}/mvnw"
But looks like
${fileWorkspaceFolder}
variable replacement is not supported.Then I tried:
"maven.executable.path": "/workspaces/project-folder/mvnw"
but got an error. This is the log:
If I run those commands in the terminal they are executed without any problem and the
dependencies.txt
file is generated in the target folder.The text was updated successfully, but these errors were encountered: