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.
Few things -
as discussed and inferred above <id>
is something that you are missing in your <execution>
tag
also, if you want to make the alias configurable please use changeAlias
in your execution as -
<goals>
<goal>changeAlias</goal>
</goals>
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
and for different executions you can try to configure different aliases as follows -
<executions>
<execution>
<goals>
<goal>importCertificate</goal>
</goals>
<phase>package</phase>
<id>executionOne</id>
<configuration>
<keystore>${project.build.directory}/client-truststore.jks</keystore>
<storepass>storepass</storepass>
<alias>alias</alias>
<file>ca.pem</file>
<noprompt>true</noprompt>
</configuration>
</execution>
<execution>
<goals>
<goal>importCertificate</goal>
</goals>
<phase>package</phase>
<id>executionTwo</id>
<!--change this from one above-->
<configuration>
<keystore>${project.build.directory}/client-truststore.jks</keystore>
<storepass>storepass</storepass>
<alias>alias</alias>
<file>ca.pem</file>
<noprompt>true</noprompt>
</configuration>
</execution>
</executions>