apache_maven

In this small post I will show you how to deploy automatically some artifacts of your build into bea_logo1Weblogic 10.3 by using the weblogic-maven-plugin

This plugin will support various tasks within the Weblogic 8.1 and 9.x environment. Such tasks as deploy, undeploy,clientgen,servicegen, and appc are supported as well as many others. The plugin uses exposed API's that are subject to change but have been tested in 8.1 SP 4-6 and 9.0 - 9.2 MP3. There are two versions of the plugin to support the two environments based on differences in the JDK. The 9.x version is currently being refactored to support the standard JSR supported deployment interface

 

Weblogic Admin Console

In the protocols section of your Admin server settings page verify that Enable Tunneling is checked (Environment – Server - Protocols).

Preparing Maven dependencies

In a Weblogic 10.3 JDK 1.6 environment the weblogic-maven-plugin requires 17 dependencies!

  • bea\modules\com.bea.core.descriptor.wl_1.1.0.0.jar
  • bea\modules\com.bea.core.descriptor_1.4.0.0.jar
  • bea\modules\com.bea.core.management.core_2.3.0.0.jar
  • bea\modules\com.bea.core.management.jmx_1.1.0.0.jar
  • bea\modules\com.bea.core.weblogic.lifecycle_1.1.0.0.jar
  • bea\modules\com.bea.core.weblogic.security.digest_1.0.0.0.jar
  • bea\modules\com.bea.core.weblogic.security.identity_1.1.0.0.jar
  • bea\modules\com.bea.core.weblogic.security.wls_2.0.1.0.jar
  • bea\modules\com.bea.core.weblogic.security_2.0.1.0.jar
  • bea\modules\com.bea.core.weblogic.socket.api_1.0.0.0.jar
  • bea\modules\com.bea.core.weblogic.workmanager_1.4.0.0.jar
  • bea\modules\javax.enterprise.deploy_1.2.jar
  • bea\wlserver_10.3\server\lib\wljmsclient.jar
  • bea\wlserver_10.3\server\lib\wls-api.jar
  • bea\wlserver_10.3\server\lib\wlsafclient.jar
  • bea\wlserver_10.3\server\lib\weblogic.jar
  • bea\wlserver_10.3\server\lib\webserviceclient.jar

but this can be reduced to just two by creating an uber jar wlfullclient.jar.

Use the following steps to create a wlfullclient.jar file for a JDK 1.6 client application:

  1. Change directories to the server/lib directory.
    cd WL_HOME/server/lib
  2. Use the following command to create wlfullclient.jar in the server/lib directory:
    java -jar wljarbuilder.jar

You can now deploy this huge jar file wlfullclient.jar  (59 MB) to either your Artifactory/Nexus/Archiva repository.

<dependency>
    <groupId>weblogic</groupId>
    <artifactId>wlfullclient</artifactId>
    <version>${weblogic.version}</version>
</dependency>

We need another jar file, this one can be find in bea/modules directory. Install also com.bea.core.descriptor.wl_1.1.0.0.jar into your local maven repository

<dependency>
    <groupId>weblogic</groupId>
    <artifactId>com.bea.core.descriptor.wl</artifactId>
    <version>1.1.0.0</version>
    <scope>provided</scope>
</dependency>

We are nearly ready, just add your deployment in a profile that is not active by default. This will allow you to deploy only in some special build with –P{profileName} in your continuous server (Hudson/Teamcity/Bamboo)

<profiles>

    <profile>
        <id>deploy_weblogic_dev</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <properties> </properties>
        <build>
            <plugins> </plugins>
        </build>
    </profile>
</profiles>

Here is the whole plugin configuration that you have to put between as usual

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>weblogic-maven-plugin</artifactId>
    <version>2.9.1</version>
    <executions>
        <execution>
            <phase>deploy</phase>
            <goals>
                <goal>deploy</goal>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <name>${webappname}</name>
        <adminServerHostName>${wls.adminServerHostName}</adminServerHostName>
        <adminServerPort>${wls.adminServerPort}</adminServerPort>
        <adminServerProtocol>t3</adminServerProtocol>
        <userId>${wls.userId}</userId>
        <password>${wls.password}</password>
        <upload>true</upload>
        <remote>true</remote>
        <verbose>false</verbose>
        <debug>false</debug>
        <targetNames>${wls.targetname}</targetNames>
        <noExit>true</noExit>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>weblogic</groupId>
            <artifactId>wlfullclient</artifactId>
            <version>${weblogic.version}</version>
        </dependency>
        <dependency>
            <groupId>weblogic</groupId>
            <artifactId>com.bea.core.descriptor.wl</artifactId>
            <version>1.1.0.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</plugin>

Remarqs

  • It is important that is set to true or maven will exit improperly!
  • Define your password as usual in settings.xml
  • Variables ${xxxx}  are self explanatory, use correct values in section of your profile

Good luck! Feel free to ask below if you have any questions.

References

http://download.oracle.com/docs/cd/E12840_01/wls/docs103/client/jarbuilder.html

comments powered by Disqus

You might like also

Fetching artifact programmatically through REST/API in Nexus 3.x
There is so many case where it is desirable to pull down artifact from Sonatype Nexus using REST API, unfortunately Nexus 3.x Rest API are still under development... Some use cases in Nexus 2.x: You have a script that uses REST call to pull down the LATEST maven artifacts every night from Nexus and deploys them. You make extensive use of the REST API in all your puppet modules You use the Atlassian Puppet module for Nexus for creating repository, …
695 Days ago
git-branch-renamer-maven-plugin
When working with many feature/release/bugix/hotfix branches, it is a bad idea to start changing the pom version as this will create merge conflicts using pull request. this plugin allow you to keep in ALL branches the same pom version for all your projects, for example MASTER-SNAPSHOT the version will be derived from branch name automagically :-) You may want to read more first these 2 short articles Update Maven pom version on GIT checkout in TeamCity maven-release-plugin with GIT git-branch-renamer-maven-plugin …
707 Days ago
Review: Getting Started with Apache Maven by Russell Gold
Some time ago I was asked if I would like to write a review about one of the new video courses from Packt Publishing. It was "Getting Started with Apache Maven" http://bit.ly/1fycmpP by Russell Gold and since I have been using Maven for some years now (since 2007) and did publish some articles myself, I thought it would be nice to help them promote Apache Maven. The course is organized in eight chapters, forty videos with a length between two …
1894 Days ago
Update Maven pom version on GIT checkout in TeamCity
Here is a solution to the following problems Deriving Maven artifact version from GIT branch, Update pom version on GIT checkout automatically, Add the ability to use Pull request with Apache Maven. You have a workflow requirement that require you to have the artifact version of a module externally defined from the current branch in GIT. For example You want to start working on a new feature branch “feature-memory-improvement”, so you branch from master a new branch named feature/feature-memory-improvement Having …
1899 Days ago
Easily Compress Web Application Resources with EhCache
Resources such as JavaScript and CSS files can be compressed before being sent to the browser, improving network efficiencies and application load time in certain case. If you are not using Apache with mod_deflate or nginx in front of your web application, you may need to implement resources compression yourself…. Wait! don’t start writing your own filter to compress files like CSS, html, txt, javascript it is way more difficult than you think to properly handle http response headers and …
2381 Days ago
Tomcat 7 and Apache Maven
Here is 3 different way to control the lifetime a local Tomcat 7 container using Apache Maven. A typical scenario would be to start a servlet container prior to running integration tests (Selenium, SAHI or using any other framework you can think of ) With the following examples, you will be able to start an instance of Tomcat 7 running your web application in the pre-integration-test phase and stop the instance in the post-integration-test phase. You can also decide to …
2381 Days ago
Apache Maven copy local file to a remote server server using SSH
I will show you in an Apache Maven configuration file how to copy files to server each time the package phase is executed. Solution with Ant SCP task This snippet of code is a ready to use code that make use of Apache Ant task scp, Just put this snippet of code in your Maven module where the assembly is executed or anywhere else to push all tar.gz files to a server just run a maven mvn package, you can …
2569 Days ago
Apache M2Eclipse: Get rid of Duplicate resources when opening resources and types
In this small post, I’ll show you how to remove duplicated resources in the Open Resource view of Eclipse Eclipse – M2Eclipse – Subversive …
2575 Days ago
Apache Maven 3 Cookbook
&160; First a big thanks to Packt Publishing for having sent me this book to review! I did enjoy going through this book, while I did not learn a lot of new stuff (I am using Apache Maven daily since 2006!), I found it to be concise and would recommend it anytime to any of my colleagues. But let’s go through my review of this cookbook of over 50 recipes towards optimal Java Software Engineering with Maven 3: Apache Maven
2717 Days ago
Apache Maven 3 Cookbook Review
Thanks to Packt Publishing for having sent me this book to review. I will publish a review in the next coming days Grasp the fundamentals and extend Apache Maven 3 to meet your needs Implement engineering practices in your application development process with Apache Maven Collaboration techniques for Agile teams with Apache Maven Use Apache Maven with Java, Enterprise Frameworks, and various other cutting-edge technologies Develop for Google Web Toolkit, Google App Engine, and Android Platforms using Apache Maven You …
2763 Days ago