-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: add useGlobalMavenExecutable
configuration
#72
base: master
Are you sure you want to change the base?
feat: add useGlobalMavenExecutable
configuration
#72
Conversation
Request someone to please guide me on how to create a PR for an earlier version? Thanks |
By default, the plugin will generate the following maven path | ||
|
||
```shell | ||
"${env.M2_HOME}/bin/mvn" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see in MavenEnvironment, this is not true :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry.
MavenEnvironment
indicates use of maven.home
,
whereas README says ${env.M2_HOME}/bin/mvn
in How the hook works section.
I'll remove this line, but maybe the other sections needs updating too?
* the complete path for `mvn` found via `maven.home` variable | ||
*/ | ||
@Parameter(property = "gcf.useGlobalMavenExecutable", defaultValue = "false") | ||
private boolean useGlobalMavenExecutable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using a maven wrapper? If not, what are you using exactly?
Isn't there some environment variable or anything set by the executed process to find its path?
That would allow us to avoid setting this property and instead add an automatic path detection to MavenEnvironment
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not using a maven wrapper. I am using IntelliJ IDEA to run maven tasks.
It does infact set the maven.home
property when any maven command is run via the IDE but the plugin somehow does not consider it.
IntelliJ sets the following property when running any maven command:
-Dmaven.home=/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3
This is an example how the package
command is run:
/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/varijkapil/Documents/Work/Development/JavaEE/work-service -Dmaven.home=/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3 -Dclassworlds.conf=/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf -Dmaven.ext.class.path=/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar -javaagent:/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=54014:/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds.license:/Applications/JetBrains/apps/IDEA-U/ch-0/211.7442.40/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2021.1.2 package
I see in MavenEnvironment
that maven.home
is given preference, but cannot figure out why it is not considered when this command is run? Instead it writes the following in the pre-commit bash script
/Users/varijkapil/Documents/Work/Development/JavaEE/work-service/mvn
Maybe a little help in this direction would be helpful.
This PR Addresses #71 by adding a new configuration option to allow users to override usage of
M2_HOME
to directly use the globalmvn
variable instead.This should allow users to allow use maven from IDE's where
M2_HOME
is sometime forcefully set by the tooling, eg. when using maven from IntelliJ IDEA