Intro
I moved my settings.xml file to a secured network share which only I can access. The next step is to encrypt various credentials inside the file as well.
Unfortunately, now when I run mvn I need to specify the location every time, e.g.:
mvn -s Z:\CONFIG\settings.xml
Solution Try - Aliases
I tried making an alis in CMDER but I always get a goal not specfied error
.
E.g. in user_aliases.cmd I add the following tries:
mvn1=echo "Using custom cmder alias (cmder user_aliases.cmd) : mvn -s Z:\CONFIG\settings.xml " & mvn -s Z:\CONFIG\settings.xml
mvn2=mvn -s Z:\CONFIG\settings.xml
They both fail with an error about goals not being passed.
So this is an issue with the arguements not being passed.
Anyone have a solution for hardcoding this location permanently???
Update
My current solution has been to edit the mvn.cmd file itself.
I added something like the following, and it works..... though it breaks mvn for anyone else wanting to use it:
echo "Modified mvn.cmd to add custom path mvn -s Z:\CONFIG\settings.xml "
"%JAVACMD%" ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %CLASSWORLDS_JAR% ^
"-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
"-Dmaven.home=%MAVEN_HOME%" ^
"-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native" ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%CLASSWORLDS_LAUNCHER% -s Z:\CONFIG\settings.xml %MAVEN_CMD_LINE_ARGS%
if ERRORLEVEL 1 goto error
goto end
I could possibly make a copy of maven to my Z drive (secured) and call that to avoid all of this.
I tried two solutions which both worked:
Move maven to folder with permissions
One solution was to move maven directly to a protected isolated folder such a shared network folder (with appropriate permissions) or user folder.
Edit the mvn cmd file
I edited the mvn.cmd file itself.
I added something like the following, and it works.....
WARNING: it breaks mvn for anyone else wanting to use it. So use only if this is not a consideration.