File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525@ REM
2626
2727@ echo off
28- setlocal enabledelayedexpansion
28+ setlocal
2929
3030set " TARGET = useage"
3131set " DEBUG = false"
@@ -118,16 +118,21 @@ if "%TARGET%"=="clean" (
118118) else if " %TARGET% " == " dependency-security-check" (
119119 set " CMD = %BASE_CMD% dependency-check:check"
120120) else if " %TARGET% " == " format-poms" (
121+ setlocal enabledelayedexpansion
121122 set " SAXON = %USERPROFILE% \.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-8\Saxon-HE-9.9.1-8.jar"
122- for /r %%P OM in (pom.xml) do (
123- echo | set /p dummyName = " Formatting %%P OM ..."
124- java -jar " %SAXON% " -s:%%P OM -xsl:format-pom.xslt -o:%%P OM
125- echo OK
123+ for /r %%P in (pom.xml) do (
124+ if exist " %%P " (
125+ set " POM = %%P "
126+ echo | set /p dummyName = " Formatting !POM! ..."
127+ java -jar " !SAXON! " -s:!POM! -xsl:format-pom.xslt -o:!POM!
128+ echo OK
126129
127- echo | set /p dummyName = " Checking for duplicate license entries in %%P OM ... "
128- java -cp " %SAXON% " net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-uri=file:%%P OM
129- echo OK
130+ echo | set /p dummyName = " Checking for duplicate license entries in !POM! ... "
131+ java -cp " !SAXON! " net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-path=!POM!
132+ echo OK
133+ )
130134 )
135+ endlocal
131136 goto end
132137) else (
133138 echo Invalid target: %TARGET%
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ if [ "${TARGET}" == "format-poms" ]; then
182182 echo " OK"
183183
184184 echo -n " Checking for duplicate license entries in ${pom} ... "
185- CMD=" java -cp ${SAXON} net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-uri=file: ${pom} "
185+ CMD=" java -cp ${SAXON} net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-path= ${pom} "
186186 $CMD
187187 echo " OK"
188188
Original file line number Diff line number Diff line change @@ -31,9 +31,18 @@ declare namespace pom = "http://maven.apache.org/POM/4.0.0";
3131declare option output:omit-xml-declaration "yes" ;
3232
3333
34- (: Must be set externally with the URI to the pom.xml file :)
35- declare variable $pom-file-uri as xs:string external ;
34+ (: Must be set externally with the file-system path to the pom.xml file :)
35+ declare variable $pom-file-path as xs:string external ;
3636
37+ declare %private function local:path-to-uri ($path as xs:string) as xs:string {
38+ if (starts-with ($path, "/" ))
39+ then
40+ "file://" || $path
41+ else
42+ "file:///" || replace ($path, "\\" , "/" )
43+ };
44+
45+ let $pom-file-uri := local:path-to-uri ($pom-file-path)
3746let $pom := doc ($pom-file-uri)
3847return
3948(
You can’t perform that action at this time.
0 commit comments