javamavenkeytool

How to import 2 different certificates with maven


I need to import two different certificates in my build process. I'm using keytool-maven-plugin, I'm able to import 1 plugin but I'm not able to import 2 different ones.

Here is my pom snippet

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>keytool-maven-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <goals>
                <goal>importCertificate</goal>
            </goals>
            <phase>package</phase>
        </execution>
    </executions>
    <configuration>
        <keystore>${project.build.directory}/client-truststore.jks</keystore>
        <storepass>storepass</storepass>
        <alias>alias</alias>
        <file>ca.pem</file>
        <noprompt>true</noprompt>
    </configuration>
</plugin>

Thanks in advance.


Solution

  • Few things -

    Source - Keytool Maven Plugin

    How to use keytool:changeAlias specifying parameters on the command line

    > mvn keytool:changeAlias -Dkeystore=/path/to/your/keystore
    > -Dstorepass=storepass -Dkeypass=keypass -Dalias=foo_alias \  -Ddestalias=new_alias