Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

Added support for paths with spaces, and bats tests. #25

Closed
wants to merge 1 commit into from
Closed

Added support for paths with spaces, and bats tests. #25

wants to merge 1 commit into from

Conversation

beverage
Copy link

@beverage beverage commented Jul 6, 2016

The maven wrapper script currently does not work in folder heirarchies that contain spaces. The simple fix was to quote the $(pwd) statements in find_maven_basedir along with some more quote-fu on the MAVEN_PROJECTBASEDIR and MAVEN_OPTS line, but I opted for a change that would be testable instead.

This involved parameterizing find_maven_basedir, and reorganizing the script to make the actual body of it excludable by bats when it is loaded.

My apologies as this will make the PR a bit messier than need be for this change, but I will do my best to highlight the most relevant bits.

  • Line 39 - relocated find_maven_basedir followed by concat_lines
  • Line 66 - test to prevent script execution when loaded by bats
  • Lines 218 and 223 - using the updated find method

I did incorporate the bats run as part of the automation launched when building yet as that would require a dependency on an external toolset and should be probably be discussed first.

Tested with bats tests, and manually on the local projects here that first exposed the issue.

The maven wrapper script currently does not work in folder heirarchies that contain spaces.  The simple fix was to quote the $(pwd) statements in find_maven_basedir along with some more quote-fu on the MAVEN_PROJECTBASEDIR and MAVEN_OPTS line, but I opted for a change that would be testable instead.

This involved parameterizing find_maven_basedir, and reorganizing the script to make the actual body of it excludable by bats when it is loaded.

My apologies as this will make the PR a bit messier than need be for this change, but I will do my best to highlight the most relevant bits.

I did incorporate the bats run as part of the automation launched when building yet as that would require a dependency on an external toolset and should be probably be discussed first.
@beverage
Copy link
Author

beverage commented Jul 6, 2016

Also, incorporated the changes in #21 as I was already dealing with pathing.

@beverage
Copy link
Author

beverage commented Jul 7, 2016

Possibly related to #23

@@ -118,7 +118,7 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s

SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, I'm seeing the following error on Windows when running mvnw.cmd in a directory name that contains spaces:

Error: Could not find or load main class With Spaces\.mvn\wrapper\maven-wrapper.jar

👍

@mosabua
Copy link
Member

mosabua commented Apr 5, 2017

Replaced with simple commit of fix in 2fea7af

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants