Maven Tomcat插件上的SSL配置 [英] SSL Configuration on Maven Tomcat Plugin

查看:142
本文介绍了Maven Tomcat插件上的SSL配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发Wicket应用.它的登录页面必须使用SSL打开.所以我做了一些编码. 但是我找不到为SSL配置Maven tomcat 7插件. 我正确创建了密钥库文件.使用keytool -genkey -alias tomcat -keyalg RSA命令 在Windows的in用户目录中.密码为password.

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.

这是我在pom.xml中定义tomcat的方式:

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>

推荐答案

在pom.xml中使用此配置,可以使它工作:

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>

这篇关于Maven Tomcat插件上的SSL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆