-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty argument tag should add empty string instead of null #150
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this and it works as expected. It preserves an empty argument.
My test case was (pom.xml
):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>none</groupId>
<artifactId>tester</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>testitnow</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./exec-test-script.sh</executable>
<arguments>
<argument>a</argument>
<argument>b</argument>
<argument />
<argument>d</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The script, exec-test-script.sh
contained:
#! /usr/bin/bash
echo Number of args is "${#@}"
for x in "$@"; do
echo " ->$x<-"
done
I verified that the third argument was omitted before the PR, and that it was included as an empty argument after the PR.
However, there still doesn't appear to be any way to preserve whitespace, if you want an argument consisting of a space, as in:
<configuration>
<executable>tr</executable>
<arguments>
<argument> </argument>
<argument>_</argument>
<argument><filename</argument>
</arguments>
</configuration>
This might be an limit of Maven itself. It seems there may have been a regression of: https://issues.apache.org/jira/browse/MNG-5380
Noticed this was still open while checking my PRs. Should this be merged? @ctubbsii |
I think it should, but I don't have commit access to this project. |
No big deal. It's probably because GitHub says I "approved" it by giving a code review. Pro tip: the gray checkmark next to an approval indicates the person submitted an approval as a non-committer performing a code review. A green checkmark would be displayed (like those at the bottom, by the status checks), if the reviewer had write access. It's a very subtle difference. Also the green checkmarks at the bottom can often be misinterpreted as a code review checkmark... I wish they used a different color for those. |
Ah I've never noticed that before, thank you for the tip! |
Created new PR since I could not update the old one (#133, issue #132 ) due to the fork being deleted.
An empty argument tag such as:
Now adds an empty string instead of
null
toString[] args
.