Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL Configuration on Maven Tomcat Plugin

I am trying to develop a Wicket app. It's login page must open with SSL. So I did some coding. But I can't find to configure the maven tomcat 7 plugin for SSL. I created keystore file properly.Using keytool -genkey -alias tomcat -keyalg RSA command It's in the in user directory on windows.It's password is password.

This is how I defined tomcat in pom.xml:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0-beta-1</version>
    <executions>
        <execution>
            <id>tomcat-run</id>
            <goals>
                <goal>exec-war-only</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <path>foo</path>
                <!-- optional only if you want to use a preconfigured server.xml file -->
                <serverXml>src/main/tomcatconf/server.xml</serverXml>
                <!-- optional values which can be configurable -->
                <attachArtifactClassifier>
                                    default value is exec-war but you can   customize
                                </attachArtifactClassifier>
                <attachArtifactClassifierType>
                                      default value is jar
                                </attachArtifactClassifierType>
                <httpsPort>8443</httpsPort>
                <keystoreFile>${user.home}/.keystore</keystoreFile>
                <keystorePass>password</keystorePass>
                <protocol>org.apache.coyote.http11.Http11AprProtocol</protocol>
            </configuration>
        </execution>
    </executions>
</plugin>
like image 890
yyy Avatar asked Jul 24 '12 14:07

yyy


People also ask

What is Tomcat7 Maven plugin?

The Tomcat7 Maven Plugin provides goals to manipulate WAR projects within the Tomcat servlet container version 7.x.


1 Answers

With this configuration in my pom.xml I get it working:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <path>/${project.build.finalName}</path>
        <contextFile>${basedir}/context.xml</contextFile>
        <httpsPort>8443</httpsPort>
        <keystoreFile>${basedir}/certificates/keystore.jks</keystoreFile>
        <keystorePass>password</keystorePass>
    </configuration>
</plugin>
like image 100
antomago Avatar answered Sep 20 '22 20:09

antomago