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

Jorge Solórzano commented on MWRAPPER-43:
-----------------------------------------

Well, the little trick I do is to make the _if command -v..._ that check wget 
and curl to intentionally fail:

This disables the wget check:
{noformat}
sed -i 's/command -v wget/command -v wgets/' mvnw{noformat}
This disables the curl check:
{noformat}
sed -i 's/command -v curl/command -v curls/' mvnw{noformat}
Then to restore is simply swap back the correct commands:
{noformat}
sed -i 's/command -v wgets/command -v wget/' mvnw
sed -i 's/command -v curls/command -v curl/' mvnw
{noformat}
A bit hackish but doesn't require to uninstall or root and with the side effect 
that you have to modify the script.

Thinking of doing more complete integration tests, those scripts require a bit 
of refactoring that allows making such tests more easily and also more 
maintainable.

> Download of jar must be quiet by default
> ----------------------------------------
>
>                 Key: MWRAPPER-43
>                 URL: https://issues.apache.org/jira/browse/MWRAPPER-43
>             Project: Maven Wrapper
>          Issue Type: Improvement
>          Components: Maven Wrapper Scripts
>    Affects Versions: 3.1.0
>            Reporter: Jorge Solórzano
>            Assignee: Herve Boutemy
>            Priority: Normal
>             Fix For: 3.1.1
>
>
> By default, the wrapper must be quiet, if the _maven-wrapper.jar_ is not 
> found the scripts try to download the jar using {*}wget{*}, {*}curl{*}, or 
> the {*}MavenWrapperDownloader{*}.java.
> The download process should only print the output when the +*MVNW_VERBOSE*+ 
> is set to true.
> Current output for *wget* when the maven-wrapper.jar is missing:
> {noformat}
> ./mvnw clean
> --2021-12-21 11:52:43--  
> https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
> Resolving repo.maven.apache.org (repo.maven.apache.org)... 151.101.132.215
> Connecting to repo.maven.apache.org 
> (repo.maven.apache.org)|151.101.132.215|:443... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 58727 (57K) [application/java-archive]
> Saving to: '/home/wrapper/api/.mvn/wrapper/maven-wrapper.jar'
> /home/jorsol/Trabajo/conf-worksp 
> 100%[==========================================================>]  57,35K  
> --.-KB/s    in 0,007s  
> 2021-12-21 11:52:44 (8,13 MB/s) - 
> '/home/wrapper/api/.mvn/wrapper/maven-wrapper.jar' saved [58727/58727]
> 11:52:45.544 [INFO] Scanning for projects...
> ...
> {noformat}
> Current output for *curl* the maven-wrapper.jar is missing:
> {noformat}
> ./mvnw clean
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  
> Current
>                                  Dload  Upload   Total   Spent    Left  Speed
> 100 58727  100 58727    0     0  1303k      0 --:--:-- --:--:-- --:--:-- 1303k
> 12:02:23.007 [INFO] Scanning for projects...
> ... 
> {noformat}
> Current output for *MavenWrapperDownloader* when the maven-wrapper.jar is 
> missing:
> {noformat}
> ./mvnw clean
> - Downloader started
> - Using base directory: /home/wrapper/api
> - Downloading from: 
> https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
> - Downloading to: /home/wrapper/api/.mvn/wrapper/maven-wrapper.jar
> Done
> 11:50:21.599 [INFO] Scanning for projects...
> ...
> {noformat}
> Everything between the _./mvnw_ and the first _INFO_ is just unwanted 
> verbosity.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to