08 March 2018

Changing weblogic.xml at deployment time


Executing: java weblogic.PlanGenerator -all -plan plan.xml ear/war(file)

Java Plan we can get a sample of Plan.xml. From here we can edit it to do modifications at deployment time:

<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
  <application-name>presentacion-0.0.1-SNAPSHOT.war</application-name>
  <variable-definition>
     <variable>  
        <name>nameValue</name> 
        <value>webapp/presentacion-0.0.1-SNAPSHOT</value> 
     </variable>    
  </variable-definition>
  <module-override>
    <module-name>presentacion-0.0.1-SNAPSHOT.war</module-name>
    <module-type>war</module-type>
    <module-descriptor external="true">
      <root-element>weblogic-web-app</root-element>
      <uri>WEB-INF/weblogic.xml</uri>
      <variable-assignment>
        <name>nameValue</name>
        <xpath>/weblogic-web-app/context-root</xpath>
        <operation>replace</operation>  
      </variable-assignment> 
    </module-descriptor>
  </module-override>
  <config-root>.</config-root>
</deployment-plan>

Maven example:

        <plugin>
                <groupId>com.oracle.weblogic</groupId>
                <artifactId>weblogic-maven-plugin</artifactId>
                <version>12.1.3-0-0</version>
                <configuration>
                    <adminurl>t3://127.0.0.1:7001</adminurl>
                    <plan>refactoring.xml</plan>
                    <user>weblogic</user>
                    <password>welcome1</password>
                    <upload>true</upload>
                    <action>deploy</action>
                    <remote>true</remote>
                    <verbose>true</verbose>
                    <source>target/${project.artifactId}-${project.version}.${project.packaging}</source>
                    <name>${project.artifactId}</name>
                    <targets>AdminServer</targets>
                </configuration>
            </plugin>

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.