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

ASF GitHub Bot commented on MJLINK-85:
--------------------------------------

matriv opened a new pull request, #212:
URL: https://github.com/apache/maven-jlink-plugin/pull/212

   Each argument is first double quoted, but because of the default 
configuration of `org.apache.maven.shared.utils.cli.shell.Shell` is also single 
quoted on top. This leads to a shell command line which is not executable.
   
   To fix this, leave the double quoting of each argument as it was, disable 
the single quoting of each argument with `Shell` configuration and wrap all the 
arguments as a whole string with single quotes, so that they are passed into 
`bin/sh -c`, example:
   
   ```
   bin/sh -c '"--module-path" "foo:bar" "--add-modules" "mod1,mod2"'
   ```
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/MJLINK) filed 
          for the change (usually before you start working on it).  Trivial 
changes like typos do not 
          require a JIRA issue.  Your pull request should address just this 
issue, without 
          pulling in other changes.
    - [ ] Each commit in the pull request should have a meaningful subject line 
and body.
    - [ ] Format the pull request title like `[MJLINK-XXX] - Fixes bug in 
ApproximateQuantiles`,
          where you replace `MJLINK-XXX` with the appropriate JIRA issue. Best 
practice
          is to use the JIRA issue title in the pull request title and in the 
first line of the 
          commit message.
    - [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [ ] Run `mvn clean verify` to make sure basic checks pass. A more 
thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the integration tests successfully (`mvn -Prun-its clean 
verify`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 
2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [ ] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   




> Wrong quoting of jlink command line
> -----------------------------------
>
>                 Key: MJLINK-85
>                 URL: https://issues.apache.org/jira/browse/MJLINK-85
>             Project: Maven JLink Plugin
>          Issue Type: Bug
>    Affects Versions: 3.2.0
>            Reporter: Marios Trivyzas
>            Priority: Critical
>
> After adding manually the dependency to apache commons lang3, (see: 
> https://issues.apache.org/jira/browse/MJLINK-84):
>  
> {{      <plugin>}}
> {{        <artifactId>maven-jlink-plugin</artifactId>}}
> {{        <version>${versions.plugin.jlink}</version>}}
> {{        <extensions>true</extensions>}}
> {{        <configuration>}}
> {{          <addModules>}}
> {{            <addModule>java.base</addModule>}}
> {{            <addModule>java.logging</addModule>}}
> {{            <addModule>java.compiler</addModule>}}
> {{            <addModule>java.desktop</addModule>}}
> {{            <addModule>java.management</addModule>}}
> {{            <addModule>java.naming</addModule>}}
> {{            <addModule>java.rmi</addModule>}}
> {{            <addModule>java.scripting</addModule>}}
> {{            <addModule>java.security.jgss</addModule>}}
> {{            <addModule>java.security.sasl</addModule>}}
> {{            <addModule>java.sql</addModule>}}
> {{            <addModule>jdk.unsupported</addModule>}}
> {{            <addModule>jdk.management</addModule>}}
> {{            <addModule>jdk.management.agent</addModule>}}
> {{            <addModule>jdk.crypto.ec</addModule>}}{{            }}
> {{            <addModule>java.instrument</addModule>}}
> {{            <addModule>jdk.httpserver</addModule>}}{{           }}
> {{            <addModule>jdk.jfr</addModule>}}{{            }}
> {{            <addModule>jdk.jcmd</addModule>}}
> {{            <addModule>jdk.jdwp.agent</addModule>}}
> {{          </addModules>}}
> {{        </configuration>}}
> {{        *<dependencies>*}}
> {{          *<dependency>*}}
> {{            *<groupId>org.apache.commons</groupId>*}}
> {{            *<artifactId>commons-lang3</artifactId>*}}
> {{            *<version>3.8.1</version>*}}
> {{          *</dependency>*}}
> {{        *</dependencies>*}}
> {{      </plugin>}}
>  
> {{I get the following error:}}
> {{[ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-jlink-plugin:3.2.0:jlink (default-jlink) on 
> project jlink-jdk:}}
> {{[ERROR] Exit code: 2}}
> {{[ERROR] Command line was: */bin/sh c 
> '/Users/matriv/.m2/jdks/jdk-22.0.2+9/Contents/Home/bin/jlink' '"module-path"' 
> '"/Users/matriv/.m2/jdks/jdk-22.0.2+9/Contents/Home/jmods"' '"add-modules"' 
> '"java.base,java.logging,java.compiler,java.desktop,java.management,java.naming,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,jdk.unsupported,jdk.management,jdk.management.agent,jdk.crypto.ec,java.instrument,jdk.httpserver,jdk.jfr,jdk.jcmd,jdk.jdwp.agent"'
>  '"-output"' 
> '"/Users/matriv/crate/crate/jlink-jdk/target/maven-jlink/default"'*}}
> {{It seems that there are single quotes being added to every single argument, 
> but there should be one pair of single quotes included the whole jlink 
> command passed to */bin/sh -c.* For example the following manual change of 
> the single quotes, results in successful execution:}}
> *{{/bin/sh c '/Users/matriv/.m2/jdks/jdk-22.0.2+9/Contents/Home/bin/jlink 
> "module-path" "/Users/matriv/.m2/jdks/jdk-22.0.2+9/Contents/Home/jmods" 
> "add-modules" 
> "java.base,java.logging,java.compiler,java.desktop,java.management,java.naming,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,jdk.unsupported,jdk.management,jdk.management.agent,jdk.crypto.ec,java.instrument,jdk.httpserver,jdk.jfr,jdk.jcmd,jdk.jdwp.agent"
>  "-output" 
> "/Users/matriv/crate/crate/jlink-jdk/target/maven-jlink/default"'}}*
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to