How to use

Brief examples on how to use the keytool:genkey and keytool:clean goals. For full documentation, click here.

Genkey Goal

How to configure keytool:genkey using pom.xml

<project>
  ...
  <packaging>pom</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>keytool-maven-plugin</artifactId>
        <executions>
           <execution>
              <goals>
                 <goal>genkey</goal>
              </goals>
           </execution>
        </executions>
        <configuration>
           <keystore>keystore</keystore>
           <dname>cn=www.example.com, ou=None, L=Seattle, ST=Washington, o=ExampleOrg, c=US</dname>
           <keypass>m2m2m2</keypass>
           <storepass>m2m2m2</storepass>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

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

  mvn keytool:genkey -Dkeystore=/path/to/your/keystore -Dstorepass=yourstorepassword -Dalias=youralias

Clean goal

Brief examples on how to use the keytool:clean goal.

How to configure keytool:clean using pom.xml

<project>
  ...
  <packaging>pom</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>keytool-maven-plugin</artifactId>
        <executions>
           <execution>
              <phase>clean</phase>
              <goals>
                 <goal>clean</goal>
              </goals>
           </execution>
        </executions>
        <configuration>
           <keystore>/path/to/your/keystore</keystore>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

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

  mvn keytool:clean [-Dkeystore=...]