IT技术及科技前沿

中文IT博客,为IT专业技术人员提供最全面的信息传播和服务

首页 新随笔 订阅 管理

Apache Maven is a software tool for building and managing Java-based projects. Now you can use a Maven plug-in for WebLogic Server (weblogic-maven-plugin) to perform deployment operations similar to those supported by the command-line utility, weblogic.Deployer. The plug-in lets you deploy, redeploy, update, and such, applications built using Maven to WebLogic Server from within the Maven environment.

To download and configure Maven on supported platforms, see http://maven.apache.org/download.html. Be sure to read the set up instructions closely to ensure that Maven is working correctly in your environment.

For detailed information on using Maven to build applications and projects, see the Maven Users Centre at http://maven.apache.org/users/index.html.

The following sections describe using the weblogic-maven-plugin for deployment:

Configuring and Using the WebLogic Maven Plug-In

Follow these steps for generating, installing, and using the weblogic-maven-plugin:

Note:

To successfully accomplish these steps, your computer must be connected to the Internet and have the necessary proxy settings configured correctly in the settings.xml file (typically $HOME/.m2/settings.xml). For further details, see http://maven.apache.org/guides/mini/guide-proxies.html.
  1. Build the plug-in JAR file using the WebLogic JarBuilder Tool (wljarbuilder) under MW_HOME/wlserver_10.3/server/lib/ with the following command:

    java -jar wljarbuilder.jar -profile weblogic-maven-plugin
    

    The weblogic-maven-plugin.jar contains a Project Object Model (pom.xml) file which specifies the groupId, artifactId, version, and packaging of the weblogic-maven-plugin.jar:

    groupId=com.oracle.weblogic
    artifactId=weblogic-maven-plugin
    version=10.3.4
    packaging=maven-plugin
    

    These fields identify the plug-in and mark a specific place in a Maven repository, acting like a coordinate system for Maven projects.

  2. Extract the pom.xml file from weblogic-maven-plugin.jar under the MW_HOME/wlserver_10.3/server/lib directory, and then copy the pom.xml file to MW_HOME/wlserver_10.3/server/lib.

    For example:

    jar xvf MW_HOME/wlserver_10.3/server/lib/weblogic-maven-plugin.jar 
    META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml
    
    cp MW_HOME/wlserver_10.3/server/lib/META-INF/maven/com.oracle.weblogic/
    weblogic-maven-plugin/pom.xml MW_HOME/wlserver_10.3/server/lib
    
  3. Provision the weblogic-maven-plugin.jar in your local Maven repository with the following command. However, for a shortened command-line goal invocation of the plug-in, follow the directions in step 5 before performing this step.

    mvn install:install-file 
    -Dfile=MW_HOME/wlserver_10.3/server/lib/weblogic-maven-plugin.jar -DpomFile=pom.xml
    

    Typical command output is like the following:

    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'install'.
    [INFO] com.oracle.weblogic: checking for updates from central
    [INFO] org.apache.maven.plugins: checking for updates from central
    [INFO] org.codehaus.mojo: checking for updates from central
    Downloading:
    http://repo1.maven.org/maven2/org/apache/maven/plugins/
    maven-install-plugin/2.2/maven-install-plugin-2.2.pom
    Downloading:
    ...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Mojo Archetype
    [INFO]    task-segment: [install:install-file] (aggregator-style)
    [INFO] ------------------------------------------------------------------------
    Downloading:
    ...
    [INFO] [install:install-file {execution: default-cli}]
    [INFO] Installing c:\oracle\Middleware\wlserver_10.3\
    server\lib\weblogic-maven-plugin.jar to 
    C:\DEMO\com\oracle\weblogic\weblogic-maven-plugin\10.3.4\
    weblogic-maven-plugin-10.3.4.jar
    [INFO] Installing C:\pom.xml to C:\DEMO\com\oracle\weblogic\weblogic-maven-plugin\10.3.4\
    weblogic-maven-plugin-10.3.4.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1 minute 3 seconds
    [INFO] Finished at: Thu Jul 22 12:11:10 PDT 2010
    [INFO] Final Memory: 13M/64M
    [INFO] ------------------------------------------------------------------------
    C:\> 
    

    Note:

    Because the mvn install command downloads Maven dependencies from the Internet which are required for the successful execution of Maven goals, you must have run mvn install at least once on your local machine.
  4. Use the Maven plug-in by employing either of the following methods:

    • From the command line—By invoking a goal from the command line.

      For example, using the goal full name to deploy:

      mvn com.oracle.weblogic:weblogic-maven-plugin:deploy
      

      Or, optionally, if you've configured using the shortened command-line goal invocation (see Step 5):

      mvn weblogic:deploy
      
    • From a POM file—By including the Maven plug-in in the application's pom.xml file.

      You add the plug-in into any life cycle phase of the project. Optionally, you can add a goal to any of the default Maven life cycle phases by adding an executions tag in the pom.xml file. The goal is then bound to that particular phase of the Maven life cycle. For example, as shown in Example C-1, the goal is bound to the "install" phase of the Maven life cycle. By doing this, every time you run the mvn install command, the deployment plug-in is also called.

      Example C-1 Maven Project pom.xml File

      <build> 
        <plugins> 
         <plugin> 
            <groupId>com.oracle.weblogic</groupId> 
            <artifactId>weblogic-maven-plugin</artifactId> 
            <version>10.3.4</version> 
            <configuration> 
                <adminurl>t3://localhost:7001</adminurl>
                <user>weblogic</user> 
                <password>weblogic123</password> 
                <upload>true</upload> 
                <action>deploy</action> 
                <remote>false</remote> 
                <verbose>true</verbose> 
      <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> 
               <name>${project.build.finalName}</name> 
            </configuration> 
            <!-- 
            <executions> 
               <execution> 
                  <phase>install</phase> 
                    <goals> 
                      <goal>deploy</goal> 
                    </goals> 
               </execution> 
             </executions> 
             --> 
        </plugin> 
          . 
          . 
          . 
       </plugins> 
      </build> 
      
  5. Optionally, you can shorten the full invocation of the plug-in by providing a pom.xmlfile, as shown in Example C-2, and modifying the settings.xml file located in your $HOME/.m2 directory, before you provision the plug-in in your Maven repository.

    1. Change the settings.xml file as follows:

      <!-- pluginGroups
       | This is a list of additional group identifiers that will be searched 
       | when resolving plugins by their prefix, for example, when invoking a  
       | command line like "mvn prefix:goal". Maven will automatically add the 
       | group identifiers "org.apache.maven.plugins" and "org.codehaus.mojo"
       | if theses are not already contained in the list.
       | -->
      <pluginGroups>
         <!-- pluginGroup
            | Specifies a further group identifier to use for plugin lookup.
          -->
         <pluginGroup>com.oracle.weblogic</pluginGroup>
       </pluginGroups>
      
    2. Replace the MW_HOME/wlserver_10.3/server/lib/pom.xml file with the following:

      Example C-2 pom.xml File

      <project xmlns="http://maven.apache.org/POM/4.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
      http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.oracle.weblogic</groupId>
        <artifactId>weblogic-maven-plugin</artifactId>
        <packaging>maven-plugin</packaging>
        <version>10.3.4</version>
        <name>Maven Mojo Archetype</name>
        <url>http://maven.apache.org</url>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0</version>
          </dependency>
        </dependencies>
       
        <build>
         <plugins>
            <plugin>
             <artifactId>maven-plugin-plugin</artifactId>
             <version>2.3</version>
             <configuration>
               <goalPrefix>weblogic</goalPrefix>
             </configuration>
            </plugin>
          </plugins>
        </build>
       
      </project>
      
    3. From within MW_HOME/wlserver_10.3/server/lib/, provision the weblogic-maven-plugin.jar in your local Maven repository as follows:

      mvn install:install-file 
      -Dfile=MW_HOME/wlserver_10.3/server/lib/weblogic-maven-plugin.jar -DpomFile=pom.xml
      
    4. Now, you can use a shortened command-line goal invocation, such as:

      mvn weblogic:deploy
      

Deployment Goals

Table C-1 lists the weblogic-maven-plugin deployment goals.

Table C-1 Maven Plug-In Deployment Goals

Short NameDescription

weblogic:deploy

Deploys or redeploys an application or module.

weblogic:undeploy

Stops the deployment and removes staged files from target servers.

weblogic:redeploy

Redeploys a running application or part of a running application.

weblogic:start-app

Starts an application.

weblogic:stop-app

Stops an application.

weblogic:list-apps

Lists the deployment names for applications and standalone modules deployed, distributed, or installed in the domain.

weblogic:update-app

Updates an application's deployment plan by redistributing the plan files and reconfiguring the application based on the new plan contents.

weblogic:help

Lists all the deployment goals.

weblogic.deploy

Full Name

com.oracle.weblogic:weblogic-maven-plugin:deploy

Short Name

weblogic:deploy

Description

Deploys an application or module.

Attributes

  • Requires a Maven 2.0 project.

  • Requires an application ready for deployment.

Parameters

Table C-2 weblogic:deploy Parameters

OptionTypeDefaultDescription

name

String

none

Deployment name to assign to a newly-deployed application or standalone module. If you do not specify this attribute, WebLogic Server assigns a deployment name to the application, based on its archive file or exploded directory.

source

String

none

Required. Archived file or exploded archive directory to deploy.

plan

String

none

Deployment plan to use when deploying the application or module.

targets

String

none

Targets on which to distribute and deploy the application or module. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

upload

Boolean

false

Copies the source files to the Administration Server's upload directory prior to deployment.

stage

Boolean

false

Copies deployment files to target servers' staging directories.

nostage

Boolean

true

Does not copy the deployment files to target servers, but leaves them in a fixed location, specified by the source option.

external_stage

Boolean

false

Does not copy the deployment files to target servers; instead, you must ensure that deployment files have been copied to the correct subdirectory in the target servers' staging directories. You can manually copy the files or use a third-party tool or script.

You can specify only one of the following attributes: stage, nostage, or external_stage. If none is specified, the default deployment mode to Managed Servers is stage; the default mode to the Administration Server and single server instances is nostage.

retiretimeout

Integer

-1

Number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.

library

Boolean

false

The deployment as a shared J2EE library or optional package.

libspecver

String

none

Specification version of a J2EE library or optional package. You can use this option only if the library or package does not include a specification version in its manifest file. libversion can be used only in combination with the library attribute.

libimplver

String

none

Implementation version of a J2EE library or optional package. You can use this option only if the library or package does not include an implementation version in its manifest file. libimplversion can be used only in combination with the library attribute.

usenonexclusivelock

Boolean

false

Deployment operation uses an existing lock, already acquired by the same user, on the domain. This option is helpful in environments where multiple deployment tools are used simultaneously and one of the tools has already acquired a lock on the domain configuration.

altappdd

String

none

Name of an alternate J2EE deployment descriptor (application.xml) to use for deployment.

altwlsappdd

String

none

Name of an alternate WebLogic Server deployment descriptor (weblogic-application.xml) to use for deployment.

securityModel

String

none

Security model to use for this deployment. Possible security models are: Deployment descriptors only, Customize roles, Customize roles and policies, Security realm configuration (advanced model). Actual valid values for this attribute are DDOnly, CustomRoles, CustomRolesAndPolicy, or Advanced.

enableSecuirtyValidation

Boolean

false

Enable validation of security data.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-3 illustrates using the weblogic:deploy goal.

Example C-3 weblogic:deploy

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:deploy  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer -Dsource=c:\apps\sample.war
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:deploy {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -deploy -source c:\apps\sample.war -targets AdminServer
<Aug 9, 2010 5:54:22 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> 
<Initiating deploy operation for application, 
sample.war [archive: c:\apps\sample.war], to Admin Server .>

Task 0 initiated: [Deployer:149026]deploy application sample.war on AdminServer.
 
Task 0 completed: [Deployer:149026]deploy application sample.war on AdminServer.
 
Target state: deploy completed on Server AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 09 17:54:23 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:undeploy

Full Name

com.oracle.weblogic:weblogic-maven-plugin:undeploy

Short Name

weblogic:undeploy

Description

Undeploys an application or module.

Attributes

  • Requires a Maven 2.0 project.

  • Requires an already deployed application.

Parameters

Table C-3 weblogic:undeploy Parameters

OptionTypeDefaultDescription

name

String

none

Required. Deployment name of a deployed application or module. If you do not specify this attribute, WebLogic Server assigns a deployment name to the application, based on its archive file or exploded directory.

appversion

String

none

Version identifier of the deployed application.

planversion

String

none

Version identifier of the deployment plan.

source

String

none

Archived file or exploded archive directory to undeploy.

plan

String

none

Deployment plan to use when undeploying.

targets

String

none

Targets from which the application or module are undeployed. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

retiretimeout

Integer

-1

Number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.

graceful

String

false

Stops the application after existing HTTP clients have completed their work. If you do not specify the graceful option, WebLogic Server immediately stops the application or module.

ignoresessions

String

false

Immediately places the application into Administration mode without waiting for current HTTP sessions to complete.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-4 illustrates using the weblogic:undeploy goal.

Example C-4 weblogic:undeploy

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:undeploy  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer -Dname=sample.war
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:undeploy]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:undeploy {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -undeploy -name sample.war -targets AdminServer
<Aug 9, 2010 10:41:16 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing undeploy operation for application, sample.war [archive: null], 
to AdminServer .>

Task 3 initiated: [Deployer:149026]remove application sample.war on AdminServer.
 
Task 3 completed: [Deployer:149026]remove application sample.war on AdminServer.
 
Target state: undeploy completed on Server AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 09 22:41:16 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:redeploy

Full Name

com.oracle.weblogic:weblogic-maven-plugin:redeploy

Short Name

weblogic:redeploy

Description

Redeploys an application or module.

Attributes

  • Requires a Maven 2.0 project.

  • Requires an application ready for deployment.

Parameters

Table C-4 weblogic:redeploy Parameters

OptionTypeDefaultDescription

name

String

none

Required. Deployment name of a deployed application or module. If you do not specify this attribute, WebLogic Server assigns a deployment name to the application, based on its archive file or exploded directory.

If you do not specify the name attribute, you must specify a source.

source

String

none

Archive file or exploded archive directory to redeploy.

plan

String

none

Deployment plan to use when redeploying.

targets

String

none

Targets on which to redeploy the application or module. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

upload

String

false

Copies the source files to the Administration Server's upload directory prior to redeployment.

delete_files

String

false

Removes static files from a server's staging directory. This attribute is valid only for unarchived deployments, and only for applications deployed using stage mode. You must specify target servers when using this attribute.

retiretimeout

Integer

-1

Number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.

filelist

String

none

One or more files to redeploy.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-5 illustrates using the weblogic:redeploy goal.

Example C-5 weblogic:redeploy

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:redeploy  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer -Dname=sample.war
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:redeploy]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:redeploy {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -redeploy -name sample.war
<Sep 9, 2010 10:12:27 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing redeploy operation for application, sample.war [archive: null], to to configurd targets.>

Task 1 initiated: [Deployer:149026]redeploy application sample.war on AdminServer.
 
Task 1 completed: [Deployer:149026]redeploy application sample.war on AdminServer.
 
Target state: redeploy completed on ServervE AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Sep 09 22:12:27 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:start-app

Full Name

com.oracle.weblogic:weblogic-maven-plugin:start-app

Short Name

weblogic:start-app

Description

Starts an application.

Attributes

  • Requires a Maven 2.0 project.

  • Requires an already deployed application.

Parameters

Table C-5 weblogic:start-app Parameters

OptionTypeDefaultDescription

adminmode

Boolean

false

Start application in Administration mode, not Production mode (which is the default). Administration mode restricts access to an application to a configured Administration channel.

name

String

none

Required. Deployment name of a deployed application or module to start.

appversion

String

none

Version of the application to start.

planversion

String

none

Version of the deployment plan to use when starting the application.

targets

String

none

Targets on which to start the application or module. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

retiretimeout

Integer

-1

Number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-6 illustrates using the weblogic:start-app goal.

Example C-6 weblogic:start-app

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:start-app  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer -Dname=sample.war
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:start-app]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:start-app {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -start -name sample.war -targets AdminServer
<Aug 9, 2010 10:54:51 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing start operation for application, sample.war [archive: null], to AdminServer
.>

Task 6 initiated: [Deployer:149026]start application sample.war on AdminServer.
Task 6 completed: [Deployer:149026]start application sample.war on AdminServer.
Target state: start completed on Server AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 09 22:54:52 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:stop-app

Full Name

com.oracle.weblogic:weblogic-maven-plugin:stop-app

Short Name

weblogic:stop-app

Description

Stops an application.

Attributes

  • Requires a Maven 2.0 project.

  • Requires an already deployed application.

Parameters

Table C-6 weblogic:stop-app Parameters

OptionTypeDefaultDescription

adminmode

Boolean

false

Indicates that a running application should switch to Administration mode and accept only Administration requests via a configured Administration channel. If this option is not specified, the running application is stopped and cannot accept Administration or client requests until is it restarted.

name

String

none

Required. Deployment name of a deployed application or module to stop.

appversion

String

none

Version identifier of the deployed application.

planversion

String

none

Version identifier of the deployment plan.

targets

String

none

Targets on which to stop the application or module. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

graceful

Boolean

false

Stops the application after existing HTTP clients have completed their work. If you do not specify the graceful option, WebLogic Server immediately stops the application or module.

ignoresessions

Boolean

false

Immediately places the application into Administration mode without waiting for current HTTP sessions to complete.

rmiGraceperiod

Integer

-1

The amount of time, in seconds, that the Work Manager accepts and schedules RMI calls until there are no more RMI requests arriving within the RMI grace period during a graceful shutdown or a retirement.

retiretimeout

Integer

-1

Number of seconds before WebLogic Server undeploys the currently-running version of this application or module so that clients can start using the new version.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-7 illustrates using the weblogic:stop-app goal.

Example C-7 weblogic:stop-app

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:stop-app  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer -Dname=sample.war
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:stop-app]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:stop-app {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -stop -name sample.war -targets AdminServer
<Aug 9, 2010 10:53:39 PM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiat
ing stop operation for application, sample.war [archive: null], to AdminServer .
>

Task 5 initiated: [Deployer:149026]stop application sample.war on AdminServer.
Task 5 completed: [Deployer:149026]stop application sample.war on AdminServer.
Target state: stop completed on Server AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 09 22:53:39 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:list-apps

Full Name

com.oracle.weblogic:weblogic-maven-plugin:list-apps

Short Name

weblogic:list-apps

Description

Lists the deployment names for applications and standalone modules deployed, distributed, or installed in the domain.

Attributes

Requires a Maven 2.0 project.

Parameters

There are no parameters required or optionally taken by this goal.

Example

Example C-8 illustrates using the weblogic:list-apps goal.

Example C-8 weblogic:list-apps

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:list-apps  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dtargets=AdminServer
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [com.oracle.weblogic:weblogic-maven-plugin:list-apps]
[INFO] ------------------------------------------------------------------------
[INFO] [weblogic:list-apps {execution: default-cli}]
weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -listapps
 sample.war
Number of Applications Found : 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Aug 09 22:52:07 PDT 2010
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:update-app

Full Name

com.oracle.weblogic:weblogic-maven-plugin:update-app

Short Name

weblogic:update-app

Description

Updates an application's deployment plan by redistributing the plan files and reconfiguring the application based on the new plan contents.

Attributes

  • Requires a Maven 2.0 project.

  • Can have an application already deployed.

Parameters

Table C-7 weblogic:update-app Parameters

OptionTypeDefaultDescription

name

String

none

Required. Deployment name of a deployed application or module. If you do not specify this attribute, WebLogic Server assigns a deployment name to the application, based on its archive file or exploded directory.

plan

String

none

Required. Deployment plan to use for updating the application's configuration. The specified deployment plan must be valid for the application's target servers. For example, the plan cannot contain null variables for required resources unless those resources were previously defined in the associated descriptors.

Update operations update only those descriptors for which there is a changed, not null value in the deployment plan. If a plan that is used by an update operation contains null variables, the current values in the corresponding descriptors are not updated.

planversion

String

none

Version identifier of the deployment plan.

targets

String

none

Targets on which to update the application or module. The value of this attribute is a comma-separated list of target servers, clusters, or virtual hosts.

upload

Boolean

false

Transfers a new deployment plan to the Administration Server before updating the application.

appversion

String

none

Version identifier of the deployed application.

id

String

none

Task identifier of a running deployment task. Make sure that the identifier is unique to all other running deployment tasks. The system automatically generates a unique identifier if you do not specify one.

submoduletargets

String

deploy

JMS Server targets for resources defined within a JMS application module. The value of this attribute is a comma-separated list of JMS server names. See Using Sub-Module Targeting with JMS Application Modules and Using WLST to Manage JMS Servers and JMS System Resources in Configuring and Managing JMS for Oracle WebLogic Server.

Example

Example C-9 illustrates using the weblogic:update-app goal.

Example C-9 weblogic:update-app

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:update-app  
-Dadminurl=t3://myhost:7001 -Duser=weblogic
 -Dpassword=mypassword -Dname=sample.war -Dremote=true
-Dupload=true -Dplan=c:\apps\sampleWar.plan

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype 10.3.4
[INFO] ------------------------------------------------------------------------
[INFO] --- weblogic-maven-plugin:10.3.4:update-app (default-cli) 
@ weblogic-maven-plugin ---

weblogic.Deployer invoked with options:  -noexit -adminurl t3://myhost:7001
-user weblogic -update -plan c:\apps\sampleWar.plan sample.war -name sample.war -upload -remote
<Oct 18, 2010 10:30:47 AM PDT> <Info> <J2EE Deployment SPI> <BEA-260121> <Initia
ting update operation for application, sample.war [archive: null], to configured
targets.>

Task 8 initiated: [Deployer:149026]update application sample.war on AdminServer.
Task 8 completed: [Deployer:149026]update application sample.war on AdminServer.
Target state: update completed on Server AdminServer
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.188s
[INFO] Finished at: Mon Oct 18 10:30:49 PDT 2010
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------

For additional usage information, see weblogic.Deployer Command-Line Reference.

weblogic:help

Full Name

com.oracle.weblogic:weblogic-maven-plugin:help

Short Name

weblogic:help

Description

Lists all the supported deployment goals.

Attributes

  • Requires a Maven 2.0 project.

Example

Example C-10 illustrates using the weblogic:help goal.

Example C-10 weblogic:help

C:\>mvn  com.oracle.weblogic:weblogic-maven-plugin:help  
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype 10.3.4
[INFO] ------------------------------------------------------------------------
[INFO] --- weblogic-maven-plugin:10.3.4:help (default-cli) @ weblogic-maven-plugin ---

The following are the goals available currently in Maven
deploy
list-apps
redeploy
start-app
stop-app
undeploy
update-app
 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.344s
[INFO] Finished at: Fri Oct 15 11:01:28 PDT 2010
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------

Troubleshooting

Table C-8 describes some common Maven plug-in errors and helps you resolve them.

Table C-8 Maven Plug-In Errors

Configuration StepError MessageResolution

Step 1: Generating the plug-in.

java –jar wljarbuilder.jar –profile weblogic-maven-plugin

Unable to access jarfile wljarbuilder.jar

Make sure that you have issued the command from within the MW_HOME/wlserver_10.3/server/lib/ directory.

Step 2: Extracting the pom.xml file from weblogic-maven-plugin.

 

The pom.xml file is created in MW_HOME/wlserver_10.3/server/lib/META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml. From this location, you must copy the pom.xml file to MW_HOME/wlserver_10.3/server/lib/ (see Step 2 in Configuring and Using the WebLogic Maven Plug-In).

Step 3: Provisioning the weblogic-maven-plugin.jar in the Maven repository.

If the provisioning is successful, you will see a Build Successful message.

Build Error

The possible issues are:

Step 4: Executing Maven goals.

If successful, you will see a Build Successful message.

Failed to resolve artifact

The possible issues are:

  • You must run the mvn install command at least once before invoking mvn weblogic:goal. This is required because there are Maven dependencies which must be retrieved from the Internet (see the Note in Step 3 in Configuring and Using the WebLogic Maven Plug-In).

  • You have executed the mvn install command from a location other than MW_HOME/wlserver_10.3/server/lib/.

  • There was no pom.xml file found under MW_HOME/wlserver_10.3/server/lib/.

posted on 2011-02-13 13:34  孟和2012  阅读(1157)  评论(0编辑  收藏  举报