我已经在 ubuntu 上安装了 7za。从命令行这有效:
7za a -tzip -pMY_SECRET -mem=AES256 secure.zip /home/user/tmp/test.txt
在一个 maven 项目中,我试图从 maven-exec 插件中调用它:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>encrypt-zip</id>
<goals>
<goal>exec</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<executable>7za</executable>
<!-- <executable>/usr/bin/7za</executable> -->
<arguments>
<argument>-tzip</argument>
<argument>-pMY_SECRET</argument>
<argument>-mem=AES256</argument>
<argument>/home/user/tmp/test.txt</argument>
<argument>secure.zip</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
但它失败并出现此错误:
7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Error:
Incorrect command line
在这里工作不多,有什么建议吗?