Oracle Weblogic Maven Plugin Quickstart

If you have worked with maven in an enterprise environment probably you have followed recipes like this one (btw thanks Mykong!) in order to integrate Oracle libraries in your projects. But nowadays you can forget about all these tricks because since the beginning of the year the Oracle Maven repository is available for public access, hooray!!!

In this blog post I am not going to reinvent the wheel and show step by step how to make the setup. For that purpose you can follow the official, and I have to say that very nice and complete, Oracle documentation.

The aim of this entry is just to share some fist impressions about the oracle maven weblogic plugins and show you how to quickly start with it. So let's get our hand dirty! My setup looks like this:

First configure the oracle maven respository in your settings.xml and remember that you have two possible locations for it (see the settings reference). Now we want to create a maven "Web Application" project to test. Netbeans make it very easy for you with three simple steps:

1. Choose project (archetype)

2. Name and location


3. And the server where you want to deploy + the profile you want to use

OK, if we have a look at our pom.xml we do not see anything special:

Now let's compile, package and deploy our application. For this task we will configure the weblogic-maven-plugin...

            <plugin>
                <groupId>com.oracle.weblogic</groupId>
                <artifactId>weblogic-maven-plugin</artifactId>
                <version>12.1.3-0-0</version>
                <configuration>
                    <adminurl>t3://localhost:7001</adminurl>
                    <targets>myserver</targets>
                    <user>weblogic</user>
                    <password>weblogic1</password>
                    <upload>true</upload>
                    <remote>true</remote>
                    <verbose>true</verbose>
                    <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
                    <name>${project.build.finalName}</name>
                </configuration>
            </plugin>

 

... and run the magic goal for deploying: com.oracle.weblogic:weblogic-maven-plugin:deploy. The configuration parameters are pretty self-explained. In netbeans you can create a "short-cut" for it (right-click in your project --> Custom),

or if you are using the command line you can shorten the the full invocation of the plugin (see Using the Weblogic Maven Plug-In for deployment). Be careful to specify the right target where you want to deploy your application. If you have setup the default domain that it is install with the developer's edition (211 MB) your AdminServer will be name myserver. Depending on your internet connection the first execution can take a while, so you can think in having a coffee...

Once the goal is executed and the coffe enjoyed, if we check in the Netbeans services tab:

or in the weblogic console, we can see that our application is there.

One last hint: the plugin for 12.1.3 works as well for the 12.2.1, the sky is the limit!!!

Conclusions:

  • The weblogic plugin cover all the cycle of a web application. You can find the list of goals here.
  • Like any other maven plugin the first run takes a while.
  • Something that probably people will not appreciate is that you need an Oracle account to access the repository. Personally for me this is no an issue...
  • As a consequence of the previous point you need to have a compatible wagon-http component in your repository and store your credentials somewhere. See Configure Maven to Use a Compatible HTTP Wagon
  • One thing that I would appreciate is the possibility of browsing the repository. You can have a look at the punch list, but anyway...

More to come, stay tuned!

Luis

Add new comment

You are here