[
https://issues.apache.org/jira/browse/MINVOKER-198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381336#comment-15381336
]
Karl Heinz Marbaise commented on MINVOKER-198:
----------------------------------------------
Thank you very much that I now have an example project which shows the issue
and by which I can reproduce the described behaviour...So I have dived into
this more in depth...and based on your {{run.sh}} example I see the problem. In
your {{run.sh}} you do the following:
{code}
mvn clean asciidoctor:process-asciidoc
-Dasciidoctor.sourceDirectory=src/main/doc
-Dasciidoctor.outputDirectory=target/docs -Dasciidoctor.attributes="toc=left
source-highlighter=coderay"
{code}
which is not equivalent to:
{code}
export MAVEN_OPTS=-Dasciidoctor.attributes="toc=left source-highlighter=coderay"
mvn clean asciidoctor:process-asciidoc
-Dasciidoctor.sourceDirectory=src/main/doc
-Dasciidoctor.outputDirectory=target/docs
{code}
The first one works perfectly cause the {{-D...}} things are handled by Maven
core (Java code) whereas the second will not work cause {{MAVEN_OPTS}} is
handled by the {{mvn}} shell script where it does expect only settings for
memory etc. and nothing else...
If you use for your integration test the {{invoker.properties}} like this:
{code}
invoker.goals=clean asciidoctor:process-asciidoc
-Dasciidoctor.sourceDirectory=src/main/doc
-Dasciidoctor.outputDirectory=target/docs -Dasciidoctor.attributes="toc=left
source-highlighter=coderay"
{code}
it will work cause it is equivalent to your {{run.sh}} script.
You can of course use line endings to make the invocation in the above more
readable like this:
{code}
invoker.goals=clean asciidoctor:process-asciidoc \
-Dasciidoctor.sourceDirectory=src/main/doc \
-Dasciidoctor.outputDirectory=target/docs \
-Dasciidoctor.attributes="toc=left source-highlighter=coderay"
{code}
This is equivalent with the usual usage on command line, cause defining cli
parameters for plugins into {{MAVEN_OPTS}} is not a good idea (as we see based
on this). To be honest I would have never got on the idea to do so..
The issue is based in the {{mvn}} script which handles no special cases in
using {{MAVEN_OPTS}}. But I don't see any chance to make this work with
{{MAVEN_OPTS}} because it would result to implement much logic into the start
shell script / batch script (windwos)...which is in contradiction to the line
we are going to reduce the logic as much as possible in the start scripts.
> mavenOpts in invoker.properties does not accept parameters with spaces
> ----------------------------------------------------------------------
>
> Key: MINVOKER-198
> URL: https://issues.apache.org/jira/browse/MINVOKER-198
> Project: Maven Invoker Plugin
> Issue Type: Bug
> Affects Versions: 2.0.0
> Environment: Maven 3.3.9 and 3.2.5.
> Linux/Mac
> Reporter: Abel Salgado Romero
> Fix For: waiting-for-feedback
>
> Attachments: mac_output.txt
>
>
> Seems that mavenOpts does some additional parsing and comand line arguments
> with spaces are not read correctly.
> This prevents writing tests that when run on console in a normal maven build
> they work.
> Here is an example of what I want to test:
> https://github.com/abelsromero/asciidoctor-maven-plugin/blob/attributes_command/src/it/article-html-attributes/invoker.properties
> If you see the "asciidoctor.attributes" is a chain with many internal
> parameters and spaces. This works on console, but not in the test.
> But the test fails with the message:
> Error: Could not find or load main class source-highlighter=coderay"
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)