[ https://issues.apache.org/jira/browse/MNG-6858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17029229#comment-17029229 ]
Karl Heinz Marbaise commented on MNG-6858: ------------------------------------------ [~Pr0methean] The command you have given will executed the compile life cycle two times cause you are using the life cycle {{compile}} after {{clean}} and furthermore using {{test}} life cycle after the {{jacoco:prepare-agent}}. In the end this will result in compiling two times. > 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)