I generated a simple demo project (2.3.0
version) from Spring Initializr to my windows 8.1
OS and below is the basic structure
C:.
└───src
├───main
│ ├───java
│ │ └───com
│ │ └───example
│ │ └───demo
│ └───resources
└───test
└───java
└───com
└───example
└───demo
I tried running mvnw.cmd clean
and getting bellow error:
C:\Users\Downloads\demo\demo>mvnw.cmd clean
"}" was unexpected at this time.
Below is the same output in powershell
PS C:\Users\Downloads\demo\demo> .\mvnw.cmd clean
"}" was unexpected at this time.
PS C:\Users\Downloads\demo\demo>
I see the issue is occurring in following lines within mvnw.cmd
file :
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
Not sure if i am missing anything.
I've just had the same problem, error in both cmd and powershell. Simply copying the project to an alternative directory solved the problem.
Im on windows 10, the project was originally in my downloads directory. I moved this into documents.