You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Svein (Jira)" <ji...@apache.org> on 2022/08/24 13:23:00 UTC

[jira] [Comment Edited] (MWRAPPER-48) Error "}" was unexpected at this time (Windows 10)

    [ https://issues.apache.org/jira/browse/MWRAPPER-48?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584240#comment-17584240 ] 

Svein edited comment on MWRAPPER-48 at 8/24/22 1:22 PM:
--------------------------------------------------------

 

I think a better way is to use:

@setlocal EnableDelayedExpansion and !WRAPPER_JAR!.
{code:java}
@setlocal EnableDelayedExpansion
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!')"^
      "}"
@endlocal
 {code}
 

 


was (Author: svein):
 

I think a better way is to use:

@setlocal EnableDelayedExpansion and !WRAPPER_JAR! 
{code:java}
@setlocal EnableDelayedExpansion
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!')"^
      "}"
@endlocal
 {code}
 

 

> Error "}" was unexpected at this time (Windows 10)
> --------------------------------------------------
>
>                 Key: MWRAPPER-48
>                 URL: https://issues.apache.org/jira/browse/MWRAPPER-48
>             Project: Maven Wrapper
>          Issue Type: Bug
>          Components: Maven Wrapper Scripts
>    Affects Versions: 0.5.6
>            Reporter: Valentin Despa
>            Priority: Major
>              Labels: waiting-for-feedback
>             Fix For: 3.1.0
>
>         Attachments: 2022-08-23_16-25-17.png, demo.zip, image-2022-02-06-14-14-42-220.png, not-working.png, working.png
>
>
> I have generated a simple project using the Spring Initializr. If I try to run the Maven wrapper from a workspace folder within Jenkins, the following error occurs:
> {{"}" was unexpected at this time}}
> If I copy the project folder and run it from a different location, it works with no issues.
> A similar issue has been reported on Stackoverflow as well: [https://stackoverflow.com/q/62028432/766177]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)