[英]appassembler maven plugin doesn't set “execute” permissions on generated script
[英]use of the tag <commandLineArguments> in the maven plugin appassembler
我正在使用Maven插件appassembler生成Unix腳本。 在其標簽中,我將如下所示:
<commandLineArguments>
<commandLineArgument>$1</commandLineArgument>
<commandLineArgument>$2</commandLineArgument>
<commandLineArgument>$3</commandLineArgument>
</commandLineArguments>
但是,結果腳本顯示$ 1 $ 2 $ 3“ $ @”
我不知道最后一個來自哪里,因此它重復了前三個參數。
Mojo的AppAssembler Maven插件生成一個腳本,該腳本始終將提供給腳本的所有命令行參數附加到JVM的啟動命令上。 因此,如果您什么也不做,則"$@"
將是用於啟動程序的JVM命令的最后一件事。
<commandLineArguments>
標記用於在ARGLIST匹配器之前插入其他命令行參數。
在我看來,您認為您需要添加位置標記才能傳遞參數,因此要添加的代碼段也是如此。 兩者都是:
關於第二點,考慮第二個參數是包含空格字符的文件名的情況。 如果我為您啟動腳本程序
$ bin/foo.sh Document.txt Document\ 2.txt "Copy of Document 3.txt" Doc4.txt
您實際上將看到以下內容通過您提供的配置傳遞到Java程序:
Document.txt
(全部為$ 1) Document
($ 2已展開,但未報價,因此現在重新評估) 2.txt
Copy
($ 3被展開,但未加引號,因此也被重新求值,空格再次視為參數分隔符) of
Document
3.txt
Document.txt
(現在ARGLIST匹配器正確提供了所有內容) Document 2.txt
Copy of Document 3.txt
Doc4.txt
解決方案很簡單。 停止嘗試配置不需要配置的內容!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.