Question

I have installed 7za on ubuntu. From commandline this works:

7za a -tzip -pMY_SECRET -mem=AES256 secure.zip /home/user/tmp/test.txt

In a maven project I am trying to call it from the maven-exec plugin:

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

But it fails with this error:

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

Not much to work with here, any suggestions?

Was it helpful?

Solution

The <argument> tags don't match exactly with your example command line, and a is missing.

Perhaps it will work if you rewrite like this:

<argument>a</argument>
<argument>-tzip</argument>
<argument>-pMY_SECRET</argument>
<argument>-mem=AES256</argument>
<argument>secure.zip</argument>
<argument>/home/user/tmp/test.txt</argument>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top