Marios Trivyzas created MJLINK-85:
-------------------------------------

             Summary: 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


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>}}{{            <!-- These 
are required to use https://github.com/crate/jmx_exporter -->}}
{{            <addModule>java.instrument</addModule>}}
{{            <addModule>jdk.httpserver</addModule>}}{{            <!-- To 
support -XX:StartFlightRecording=[...] -->}}
{{            <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