Skip to main content

Weblogic Tip #2 - Using Maven to create a Weblogic domain

Posted by mriem on May 28, 2014 at 8:03 AM PDT

If you like to automate things you might wonder if it is possible to create a Weblogic domain using Maven? Indeed that is possible. See the steps below!

  1. Install the Maven plugin
  2. Create the Weblogic domain

1. Install the Maven plugin

Please do to step #1 of Weblogic Tip #1

2. Create the Weblogic domain

Add the following snippet to your POM

<build>
  <plugins>
    <plugin>
      <groupId>com.oracle.weblogic</groupId>
      <artifactId>wls-maven-plugin</artifactId>
      <version>12.1.2.0</version>
    </plugin>
  <plugins>
</build>
<properties>
  <adminurl>t3://localhost:7001</adminurl>
  <domainHome>C:/Wls12.1.2/user_projects/domains/mydomain</domainHome>
  <middlewareHome>C:/Wls12.1.2</middlewareHome>
  <weblogicHome>C:/Wls12.1.2/wlserver</weblogicHome>
  <user>admin</user>
  <password>yourpassword</password>
  <name>${project.build.finalName}</name>
  <failOnError>false</failOnError>
  <timeout>60</timeout>
</properties>

Note this blog entry assumes WLS 12.1.2, so replace it with the appropriate version where necessary.

Now in the root directory of the project you can issue the following to create the domain:

mvn -N com.oracle.weblogic:wls-maven-plugin:create-domain -Djava.security.egd=file:/dev/./urandom

This will create the domain in C:/Wls12.1.2/user_projects/domains/mydomain

Enjoy!

Related Topics >>