【发布时间】:2011-06-03 08:35:50
【问题描述】:
我现在正在尝试使用 oracle weblogic maven 插件将应用程序部署到具有管理端口的管理服务器。 我正在使用 t3s 协议进行连接,但我想知道是否可以在 maven 插件/参数中设置自定义密钥库和证书 在 pom.xml 或命令行中。 我在互联网上找不到解决方案。 非常感谢您的帮助。
【问题讨论】:
标签: plugins ssl maven weblogic
我现在正在尝试使用 oracle weblogic maven 插件将应用程序部署到具有管理端口的管理服务器。 我正在使用 t3s 协议进行连接,但我想知道是否可以在 maven 插件/参数中设置自定义密钥库和证书 在 pom.xml 或命令行中。 我在互联网上找不到解决方案。 非常感谢您的帮助。
【问题讨论】:
标签: plugins ssl maven weblogic
理论上,您可以在 maven opts 中设置 weblogic ssl 标头 - 就像这样 -Dweblogic.security.TrustKeyStore=CustomTrust -Dweblogic.security.CustomTrustKeyStoreFileName=
但插件似乎并没有像 weblogic.Deployer 那样拾取这些。这有点奇怪,因为 maven 插件无论如何都只是运行部署程序。
我还尝试将 java 密钥库设置为自定义密钥库(也没有运气)
【讨论】:
这个问题就像“老”:) - 但似乎没有确凿的答案,因为这个问题出现在 google 的前 10 名中,这就是我为使 maven -> weblogic 部署工作所做的工作
使用: maven 3.2.3 部署到 WLS 12.1.3 和 WLS 12.1.3 DEV(不要忘记在开始之前执行配置脚本 - 好吧 - 任何事情)
设置(完成一次)
按照Oracle Docs for the Maven Plugin 设置插件。简而言之:
主要是从 WLS DEV zip 安装一个 maven 插件来安装另一个 maven 插件:
cd %WL_HOME%\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3
mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar
安装要用于部署的插件:
mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=%WL_HOME%
验证插件是否正常:
mvn help:describe -DgroupId=com.oracle.weblogic -DartifactId=weblogic-maven-plugin -Dversion=12.1.3-0-0
如果您需要将其添加到 Maven 存储库代理,您可以临时更改本地存储库的路径,执行这些命令,这就是所需的(在我的情况下约为 230MB)。我会在 maven 代理上添加另一个第三方存储库,并将所有内容放在那里,以防您以后需要清理。
然后使用InstallCert 工具将 SSL 证书导入新的密钥库。我们将把这个密钥库放在创建 EAR 文件并执行部署的 maven 模块中。
部署
准备好 EAR 文件后,您需要将其添加到构建部分: (不是 SSL / keystore 乱搞只在使用 t3s 时才需要,如果不涉及自签名证书,您显然会跳过属性设置)
“TrustKeyStore=CustomStore”参数是必需的!名称不得更改。
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<properties>
<weblogic.security.TrustKeyStore>CustomTrust</weblogic.security.TrustKeyStore>
<weblogic.security.CustomTrustKeyStoreFileName>${basedir}/src/main/keystore/cacerts.dev.jks</weblogic.security.CustomTrustKeyStoreFileName>
<weblogic.security.TrustKeystoreType>JKS</weblogic.security.TrustKeystoreType>
<weblogic.security.CustomTrustKeyStorePassPhrase>changeit</weblogic.security.CustomTrustKeyStorePassPhrase>
</properties>
</configuration>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>12.1.3-0-0</version>
<configuration>
<adminurl>t3s://HOSTNAME_HERE:7101</adminurl>
<user>WLS-USER-IN-DEPLYOERS-GROUP</user>
<password>WLS-USER-PASSWORD</password>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<targets>TARGET_SERVERNAME_IN_WLS_TO_DEPLOY_TO</targets>
<verbose>true</verbose>
<name>YouApplicationName</name>
<remote>true</remote>
<upload>true</upload>
</configuration>
<executions>
<execution>
<id>wls-deploy-dev</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
上述配置将在安装阶段部署 EAR - 随意更改为 weblogic-maven-plugin 的阶段。我猜它也可能在个人资料中。
部署愉快:)
链接:
【讨论】: