You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Chris Hennick (Jira)" <ji...@apache.org> on 2020/02/01 20:52:00 UTC

[jira] [Updated] (MNG-6858) Need a way to skip empty-string arguments

     [ https://issues.apache.org/jira/browse/MNG-6858?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Hennick updated MNG-6858:
-------------------------------
    Description: 
I have a bash script that sets a sometimes-empty variable as follows:

 
{code:java}
if [ "${ANDROID}" = "true" ]; then
   MAYBE_ANDROID_FLAG=-Pandroid
 else
   MAYBE_ANDROID_FLAG=
 fi{code}
{{}}

 

It's used like so:

 
{code:java}
mvn ${MAYBE_ANDROID_FLAG} clean compile jacoco:instrument jacoco:prepare-agent test jacoco:restore-instrumented-classes jacoco:report -e -B}}{code}
 

Shell-scripting best practices dictate that ${MAYBE_ANDROID_FLAG} above should be in double quotes, but when I do that, I get 'Unknown lifecycle phase ""'. For it to be possible to follow best practices, then, we need a way to make Maven skip over command-line arguments that are empty strings.

  was:
I have a bash script that sets a sometimes-empty variable as follows:

{{if [ "${ANDROID}" = "true" ]; then}}
{{  MAYBE_ANDROID_FLAG=-Pandroid}}
{{else}}
{{  MAYBE_ANDROID_FLAG=}}
{{fi}}

{{It's used like so:}}

{{mvn ${MAYBE_ANDROID_FLAG} clean compile jacoco:instrument jacoco:prepare-agent \}}
{{ test jacoco:restore-instrumented-classes jacoco:report -e -B}}
{code:java}
Shell-scripting best practices dictate that ${MAYBE_ANDROID_FLAG} above should be in double quotes, but when I do that, I get 'Unknown lifecycle phase ""'. For it to be possible to follow best practices, then, we need a way to make Maven skip over command-line arguments that are empty strings.


{code}
 


> Need a way to skip empty-string arguments
> -----------------------------------------
>
>                 Key: MNG-6858
>                 URL: https://issues.apache.org/jira/browse/MNG-6858
>             Project: Maven
>          Issue Type: Improvement
>          Components: Command Line
>    Affects Versions: 3.6.1
>         Environment: Ubuntu 19.10
>            Reporter: Chris Hennick
>            Priority: Major
>
> I have a bash script that sets a sometimes-empty variable as follows:
>  
> {code:java}
> if [ "${ANDROID}" = "true" ]; then
>    MAYBE_ANDROID_FLAG=-Pandroid
>  else
>    MAYBE_ANDROID_FLAG=
>  fi{code}
> {{}}
>  
> It's used like so:
>  
> {code:java}
> mvn ${MAYBE_ANDROID_FLAG} clean compile jacoco:instrument jacoco:prepare-agent test jacoco:restore-instrumented-classes jacoco:report -e -B}}{code}
>  
> Shell-scripting best practices dictate that ${MAYBE_ANDROID_FLAG} above should be in double quotes, but when I do that, I get 'Unknown lifecycle phase ""'. For it to be possible to follow best practices, then, we need a way to make Maven skip over command-line arguments that are empty strings.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)