WebLogic 14 Maven启动方式下的JRebel配置方案咨询
为Maven启动的WebLogic 14配置JRebel
方法1:通过MAVEN_OPTS环境变量传递JVM参数
和之前bat脚本的逻辑一致,将原有的Java选项转移到MAVEN_OPTS环境变量中:
- 启动Maven命令前,执行以下环境变量配置:
set REBEL_HOME=%VIEW_HOME%\...\jrebel5 if exist "%VIEW_HOME%\...\jrebel5\jrebel.jar" set REBEL_HOME=%VIEW_HOME%\...\jrebel5 if exist %REBEL_HOME%\jrebel.jar ( set MAVEN_OPTS=-noverify -javaagent:%REBEL_HOME%\jrebel.jar -DAPP_HOME=%APP_HOME% -Drebel.log=true -Drebel.metro_plugin=true %MAVEN_OPTS% ) - 随后执行你的Maven启动命令,例如
mvn weblogic:start-server(具体命令根据项目插件配置调整)
方法2:在WebLogic Maven插件的pom.xml配置中添加JVM参数
如果项目使用weblogic-maven-plugin启动WebLogic,可直接在插件配置内指定JVM参数:
<build> <plugins> <plugin> <groupId>com.oracle.weblogic</groupId> <artifactId>weblogic-maven-plugin</artifactId> <version>14.1.1.0.0</version> <configuration> <!-- 其他WebLogic插件配置项 --> <jvmArgs> -noverify -javaagent:${VIEW_HOME}/.../jrebel5/jrebel.jar -DAPP_HOME=${APP_HOME} -Drebel.log=true -Drebel.metro_plugin=true </jvmArgs> </configuration> </plugin> </plugins> </build>
注:需确保VIEW_HOME和APP_HOME能在Maven环境中正确解析,也可直接写入绝对路径,或通过Maven属性定义后引用。
方法3:通过Maven Surefire/Failsafe插件配置(测试阶段启动场景)
若WebLogic是在测试环节启动(如单元测试/集成测试),可在Surefire/Failsafe插件中配置JVM参数:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.2.5</version> <configuration> <argLine> -noverify -javaagent:${VIEW_HOME}/.../jrebel5/jrebel.jar -DAPP_HOME=${APP_HOME} -Drebel.log=true -Drebel.metro_plugin=true </argLine> </configuration> </plugin>
验证配置生效
启动WebLogic后,检查日志是否出现JRebel启动标识(如JRebel: Starting up),或访问JRebel默认控制台端口8888确认加载状态。
内容的提问来源于stack exchange,提问作者Undertaker
相关产品推荐
相关产品推荐

