Skip to content
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

Argument quoting prevents expansion of glob expressions and environment variables on macOS #458

Open
Johennes opened this issue Nov 11, 2024 · 0 comments

Comments

@Johennes
Copy link

On macOS the following configuration results in an error.

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.5.0</version>
    <configuration>
      <skip>${skip.saving.reports}</skip>
    </configuration>
    <executions>
      <execution>
        <id>save_reports</id>
        <phase>post-integration-test</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <executable>ls</executable>
          <arguments>
            <argument>src/*</argument>
          </arguments>
          <outputFile>out.log</outputFile>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>
$ cat out.log
ls: src/*: No such file or directory

This is despite the fact that the directory exists and is non-empty on my system:

$ ls src/*
src/main:
java		resources

src/test:
resources

To further illustrate the problem, trying to echo $SHELL will output "$SHELL" rather than expanding the variable.

<goals>
  <goal>exec</goal>
</goals>
<configuration>
  <executable>echo</executable>
  <arguments>
    <argument>$SHELL</argument>
  </arguments>
  <outputFile>out.log</outputFile>
</configuration>
$ cat out.log
$SHELL

I haven't checked any of the plugin's code but my suspicion is that the arguments are quoted which prevents the shell from expanding them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant