© 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An...

66
1 | © 2011 Oracle Corporation Proprietary and Confidential

Transcript of © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An...

Page 1: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

1 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 2: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be y yincorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development,upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

2 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 3: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Using Maven with WebLogic Server

3 | © 2011 Oracle Corporation

Proprietary and Confidential

g gJeffrey West, Sr. Principal Product Manager

@JeffreyAWest

Page 4: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Agenda

• Understanding Apache MavenW ki ith W bL i S f M• Working with WebLogic Server from Maven

• Advanced Uses of Maven with WebLogic Server• Java IDEs and Maven

4 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 5: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

U d t di A hUnderstanding Apache Maven

5 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 6: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

What is MavenUnderstanding Apache Maven

• An Apache open source project• Maven is:

Understanding Apache Maven

– An automated build system + – A project management system + – A library and dependency handling system +

A j d i i– A project description system + – A site generation system + – …

M tMaven is a project management tool which encompasses a project object model, a set of standards, a project lifecycle, a dependency• Mature

– Maven 1.0 2004– Maven 2.0 2005– Maven 3 0 end 2010

object model, a set of standards, a project lifecycle, a dependency management system, and logic for executing plugin goals at defined phases in a lifecycle. When you use Maven, you describe your project using a well‐defined project object model, Maven can then apply cross‐cutting logic from a set of shared (or custom) plugins. 

Jason Van Zyl Sonatype

6 | © 2011 Oracle Corporation

Proprietary and Confidential

– Maven 3.0 end 2010 Jason Van Zyl, Sonatype

Page 7: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Primary Maven ConceptsUnderstanding Apache Maven

• Project Object Model (POM)– A project is the fundamental unit of work in the Maven universe

Understanding Apache Maven

– The POM describes the project, its name/version, type, dependencies, etc.– Portable!

• Convention over Configuration– Sensible default behaviours for projects– Standard directory layout for project, no configuration necessary, no path settings required– Enables automation of build and packaging process– Use default directories to locate resources, sources, tests, generate classes, packages– Well defined project lifecycle

7 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 8: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Maven Build Lifecycle, Phases and GoalsUnderstanding Apache Maven

• Maven 2.0 is based around the central concept of a build lifecycle– The process for building and distributing a particular artifact (project) is clearly defined

Understanding Apache Maven

– Only necessary to learn a small set of commands to build any Maven project, the POM ensures the project is built correctly

– default, clean, site

f f f f• Build lifecycles are further defined by a set of build phases– A build phase represents a stage in the lifecycle– Executed sequentially to complete the default lifecycle

• Build phase made up of goals– Phases are composed of goals that perform actual tasks– Default goal bindings for standard lifecycle phases

Pl i t ib t dditi l l t j t

8 | © 2011 Oracle Corporation

Proprietary and Confidential

– Plugins contribute additional goals to project

Page 9: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Maven Default Lifecycle

validate: ensure the compile compile the

test: test the compiled source code using a  package: take the 

compiled code andvalidate: ensure the project is correct and all necessary information is available

compile: compile the source code of the project

gsuitable unit testing framework;  tests should not require the code be packaged or deployed

compiled code and package it in its distributable format, such as a JAR, WAR, etc.

integration‐test: process and deploy the package if necessary into anverify: run checks to 

install: install the package into the local 

deploy: for final release, copies the final package  necessary into an 

environment where integration tests can be run

verify the package is valid and meets quality criteria

repository, for use as a dependency in other projects locally

to the remote repository for sharing with other developers and projects.

9 | © 2011 Oracle Corporation

Proprietary and Confidential

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Page 10: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Primary Maven Concepts - RepositoriesLocating Dependencies and Plugins

• A Maven repository holds build artifacts, dependencies and Plugins• Two strict types of repositories

Locating Dependencies and Plugins

yp p– Local– Remote

• Maven automatically looks in remote repositories for missing• Maven automatically looks in remote repositories for missing dependencies/plugins declared in a project

• Default PUBLIC repository is Maven Centralhttp://repo1 maven org/maven2/– http://repo1.maven.org/maven2/

• Additional PUBLIC repositories can be easily defined– Java repository: http://download.java.net/maven/2/

10 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 11: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Primary Maven Concepts - DependenciesDependency Specification & Management• Maven looks for dependencies using:

– Group Id / Artifact Id / Versionf

Dependency Specification & Management

d d id d i• Dependencies can be scoped for:– Compile / Test / Packaging / Runtime

• Maven automatically manages the download of declared dependencies in

<dependencies>

<dependency><groupId>com.oracle.weblogic</groupId>

tif tId bl i f ll / tif tId

<dependencies>

<dependency><groupId>com.oracle.weblogic</groupId>

tif tId bl i f ll / tif tIddownload of declared dependencies in a project• Obtained from public and/or corporate

repositories

<artifactId>weblogic-full</artifactId><version>12.1.1</version><scope>compile</scope>

</dependency>

<artifactId>weblogic-full</artifactId><version>12.1.1</version><scope>compile</scope>

</dependency>p• Stored in local repository for next use

• Declare dependencies, no need to ship libraries with project

...

</dependencies>

...

</dependencies>

11 | © 2011 Oracle Corporation

Proprietary and Confidential

p j

Page 12: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Primary Maven Concepts - Plugins

• Plugins perform the work in the Maven ecosystem

• Default set of plugins exists from Apache <plugins><plugins>

– Bound to lifecycles and phases– Examples: Compile, JAR, WAR, etc.

• Declaratively configured

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration>

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration>– Similar model to Project dependencies/libraries

– Automated download if hosted in public repository– Can be manually installed

C b t d t d l l

<configuration><source>1.6</source><target>1.6</target>

</configuration></plugin>

<configuration><source>1.6</source><target>1.6</target>

</configuration></plugin>

• Can be executed as standalone goals– mvn wls:deploy

• Can be bound to execute for a given lifecycle/phasemvn deploy

</plugins>

</plugins>

12 | © 2011 Oracle Corporation

Proprietary and Confidential

– mvn deploy

Page 13: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

The Maven Process: End-to-End

ProjectMavenPlugins

Input Output

Projectpom.xml

l

Plugins

Local Repository Maven Build packageBuild packageBuild package

Custom Plugins

13 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 14: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

A Sample Maven Web Project for EE6…

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1.1</version>

…<plugin>

<groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1.1</version>

<project><artifactId>simple-maven-example</artifactId><modelVersion>4.0.0</modelVersion><groupId>com.oracle.weblogic.examples</groupId><packaging>war</packaging>

<project><artifactId>simple-maven-example</artifactId><modelVersion>4.0.0</modelVersion><groupId>com.oracle.weblogic.examples</groupId><packaging>war</packaging> e s o / e s o

<configuration><failOnMissingWebXml>false</failOnMissingWebXml>

</configuration></plugin>

</plugins>

e s o / e s o<configuration><failOnMissingWebXml>false</failOnMissingWebXml>

</configuration></plugin>

</plugins>

<packaging>war</packaging><version>1.0</version><name>simple-maven-example</name><build><plugins><plugin>

<packaging>war</packaging><version>1.0</version><name>simple-maven-example</name><build><plugins><plugin> p g

</build><dependencies><dependency><groupId>javax</groupId><artifactId>javaee-api</artifactId>

p g</build><dependencies><dependency><groupId>javax</groupId><artifactId>javaee-api</artifactId>

plugin<groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.6</source><target>1.6</target>

plugin<groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.6</source><target>1.6</target>

<version>6.0</version><scope>provided</scope>

</dependency></dependencies>

</project>

<version>6.0</version><scope>provided</scope>

</dependency></dependencies>

</project>

g g</configuration>

</plugin>…

g g</configuration>

</plugin>…

Available at http://java net/projects/weblogic examples/sources/weblogic 12c

14 | © 2011 Oracle Corporation

Proprietary and Confidential

Available at http://java.net/projects/weblogic-examples/sources/weblogic-12c-user-examples/show/jeffrey.west/maven-examples/simple-maven-example

Page 15: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Building the Sample Web ProjectC:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example>mvn packageC:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example>mvn package

• Add example of mvn running sample pom.

[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building simple-maven-example[INFO] task-segment: [package][INFO] ------------------------------------------------------------------------[INFO] [resources:resources {execution: default-resources}][WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building simple-maven-example[INFO] task-segment: [package][INFO] ------------------------------------------------------------------------[INFO] [resources:resources {execution: default-resources}][WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent![INFO] skip non existing resourceDirectory C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\src\main\resources[INFO] [compiler:compile {execution: default-compile}][INFO] Compiling 1 source file to C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\classes[INFO] [resources:testResources {execution: default-testResources}][WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent![INFO] skip non existing resourceDirectory C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\src\test\resources[INFO] [compiler:testCompile {execution: default-testCompile}]

[INFO] skip non existing resourceDirectory C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\src\main\resources[INFO] [compiler:compile {execution: default-compile}][INFO] Compiling 1 source file to C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\classes[INFO] [resources:testResources {execution: default-testResources}][WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent![INFO] skip non existing resourceDirectory C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\src\test\resources[INFO] [compiler:testCompile {execution: default-testCompile}][INFO] No sources to compile[INFO] [surefire:test {execution: default-test}][INFO] No tests to run.[INFO] [war:war {execution: default-war}][INFO] Packaging webapp[INFO] Assembling webapp [simple-maven-example] in [C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\simple-maven-example-1.0][INFO] Processing war project

[INFO] No sources to compile[INFO] [surefire:test {execution: default-test}][INFO] No tests to run.[INFO] [war:war {execution: default-war}][INFO] Packaging webapp[INFO] Assembling webapp [simple-maven-example] in [C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\simple-maven-example-1.0][INFO] Processing war project[INFO] Webapp assembled in [24 msecs][INFO] Building war: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\simple-maven-example-1.0.war[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 1 second[INFO] Finished at: Wed Jan 04 16:15:51 PST 2012

O /

[INFO] Webapp assembled in [24 msecs][INFO] Building war: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\simple-maven-example\target\simple-maven-example-1.0.war[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 1 second[INFO] Finished at: Wed Jan 04 16:15:51 PST 2012

O /

15 | © 2011 Oracle Corporation

Proprietary and Confidential

[INFO] Final Memory: 12M/29M[INFO] ------------------------------------------------------------------------[INFO] Final Memory: 12M/29M[INFO] ------------------------------------------------------------------------

Page 16: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

W bL i S dWebLogic Server and Maven

16 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 17: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Server Maven Support Overview

• Introduced with WebLogic Server 11g R1 PS3 (10.3.4) supporting Application Deployment operations– Maven Mojo + WebLogic Deployer + WebLogic Clientj g p y g– Supported Deployment Lifecycle operations: list-apps, deploy/undeploy, start, stop and

update

• WebLogic 12c (12.1.1) provides additional functionality since the 11g release– Installation of Weblogic ZIP Distribution onto a machine where WebLogic has not been installed– WebLogic Domain Creation

Start/Stop WebLogic Servers– Start/Stop WebLogic Servers– Execute WLST Scripts

17 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 18: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic 12.1.1 - Maven Integration Update

• Enable/support/automate the full development lifecycle from Maven N M l /f ti l t• New Maven goals/functional support – install: automate install from zip file– domain creation: create a simple domain

New

New

– server lifecycle: start-server, stop-server– wlst: execute inline and external WLST scripts– appc: compile Maven artifacts using appc

WebLogic DomainDevelopment Server

Spring Apps

Java EE

New

New

New – appc: compile Maven artifacts using appc– deployment: deploy apps to server

• Simple and intuitive

e

18 | © 2011 Oracle Corporation

Proprietary and Confidential

• Additional WebLogic/FMW enhancements planned

Page 19: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Using the WebLogic - Maven Plugin

• Install WebLogic Maven Plugin into local Maven repository

• Configure WebLogic Maven Plugin for use with a project through the POM

• Use WebLogic Maven Plugin goals to enact WebLogic installation, domain creation & application deployment operations

19 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 20: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Installing the WebLogic Maven Plugin

• Use Maven install:install-file goal to install thewls maven plugin jar librarywls-maven-plugin.jar library– Must specify name, version and other meta-data to describe and

uniquely identify plugin (coordinates)– Can extract and use pom.xml from wls-maven-plugin.jar to

automatically supply coordinatesinstall:install file will install the plugin into your local repository– install:install-file will install the plugin into your local repository

• Alternatively deploy:deploy-file can be used to deploy the plugin to a remote repository

20 | © 2011 Oracle Corporation

Proprietary and Confidential

plugin to a remote repository

Page 21: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Installing the WebLogic Maven Plugin

C:\wls1211\wlserver_12.1\server\lib>jar xvf wls-maven-plugin.jar META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xmlinflated: META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xml

C:\wls1211\wlserver 12 1\server\lib>mvn install:install file Dfile=wls maven plugin jar DpomFile=META

C:\wls1211\wlserver_12.1\server\lib>jar xvf wls-maven-plugin.jar META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xmlinflated: META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xml

C:\wls1211\wlserver 12 1\server\lib>mvn install:install file Dfile=wls maven plugin jar DpomFile=METAC:\wls1211\wlserver_12.1\server\lib>mvn install:install-file -Dfile=wls-maven-plugin.jar -DpomFile=META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xml[INFO] Scanning for projects...[INFO] Searching repository for plugin with prefix: 'install'.[INFO] ------------------------------------------------------------------------[INFO] Building WebLogic Server Maven Plugin

C:\wls1211\wlserver_12.1\server\lib>mvn install:install-file -Dfile=wls-maven-plugin.jar -DpomFile=META-INF/maven/com.oracle.weblogic/wls-maven-plugin/pom.xml[INFO] Scanning for projects...[INFO] Searching repository for plugin with prefix: 'install'.[INFO] ------------------------------------------------------------------------[INFO] Building WebLogic Server Maven Plugin[INFO] task-segment: [install:install-file] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [install:install-file {execution: default-cli}][INFO] Installing C:\wls1211\wlserver_12.1\server\lib\wls-maven-plugin.jar to C:\Data\tools\maven-repository\com\oracle\weblogic\wls-maven-plugin\12.1.1.0\wls-maven-plugin-12.1.1.0.jar[INFO] Installing C:\wls1211\wlserver 12.1\server\lib\pom.xml to C:\Data\tools\maven-repository\com\oracle\weblogic\wls-maven-plugin\12.1.1.

[INFO] task-segment: [install:install-file] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [install:install-file {execution: default-cli}][INFO] Installing C:\wls1211\wlserver_12.1\server\lib\wls-maven-plugin.jar to C:\Data\tools\maven-repository\com\oracle\weblogic\wls-maven-plugin\12.1.1.0\wls-maven-plugin-12.1.1.0.jar[INFO] Installing C:\wls1211\wlserver 12.1\server\lib\pom.xml to C:\Data\tools\maven-repository\com\oracle\weblogic\wls-maven-plugin\12.1.1.[INFO] Installing C:\wls1211\wlserver_12.1\server\lib\pom.xml to C:\Data\tools\maven repository\com\oracle\weblogic\wls maven plugin\12.1.1.0\wls-maven-plugin-12.1.1.0.pom[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

[INFO] Installing C:\wls1211\wlserver_12.1\server\lib\pom.xml to C:\Data\tools\maven repository\com\oracle\weblogic\wls maven plugin\12.1.1.0\wls-maven-plugin-12.1.1.0.pom[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

21 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 22: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Configure WebLogic Maven Plugin in ProjectMaven pom xml Configuration• WebLogic Maven Plugin needs to be configured as a plugin for a project to enable it to be used

<project> <build> <plugins> <plugin>

• Specify plugin coordinates, target server configuration and Middleware Home

Maven pom.xml Configuration

Specify plugin coordinates, target server configuration and Middleware Home

<build><plugins>

<plugin><groupId>com.oracle.weblogic</groupId>

<build><plugins>

<plugin><groupId>com.oracle.weblogic</groupId>g p g g p<artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration><middlewareHome>c:\wls1211</middlewareHome><adminurl>t3://127.0.0.1</adminurl>

g p g g p<artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration><middlewareHome>c:\wls1211</middlewareHome><adminurl>t3://127.0.0.1</adminurl><user>weblogic</user><password>welcome1</password>

</configuration></plugin>

</plugins>

<user>weblogic</user><password>welcome1</password>

</configuration></plugin>

</plugins>

22 | © 2011 Oracle Corporation

Proprietary and Confidential

</build></build>

Page 23: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

W bL i M Pl iWebLogic Maven PluginDeployment Lifecycle Demo

23 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 24: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Executing WebLogic Maven Plugin GoalsI k l l i l di tl f d li• Invoke wls-maven-plugin goals directly from mvn command line

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example>mvn wls:list-apps[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example>mvn wls:list-apps[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:list-apps] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:list-apps {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: list-apps ++[INFO] ++ ++

[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:list-apps] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:list-apps {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: list-apps ++[INFO] ++ ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -listappstest-projectsimple-maven-example-1.0Number of Applications Found : 2[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL

[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -listappstest-projectsimple-maven-example-1.0Number of Applications Found : 2[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:44:24 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example>

[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:44:24 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example>

24 | © 2011 Oracle Corporation

Proprietary and Confidential

g p j y p g p y pg p j y p g p y p

Page 25: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Deploy

$ mvn wls:deploy -Dname=weblogic-deployment-example-1.0 -Dsource=target/weblogic-deployment-example-1.0.war[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example

$ mvn wls:deploy -Dname=weblogic-deployment-example-1.0 -Dsource=target/weblogic-deployment-example-1.0.war[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:deploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:deploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: deploy ++[INFO] ++====================================================================++

[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:deploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:deploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: deploy ++[INFO] ++====================================================================++[ ]weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -deploy -name weblogic-deployment-example-1.0 -source target/weblogic-deployment-example-1.0.war<Jan 4, 2012 4:50:28 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 2 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Task 2 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.

[ ]weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -deploy -name weblogic-deployment-example-1.0 -source target/weblogic-deployment-example-1.0.war<Jan 4, 2012 4:50:28 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 2 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Task 2 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Target state: deploy completed on Server AdminServer[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

Target state: deploy completed on Server AdminServer[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

25 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 26: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Redeploy

• Redeploy$ mvn wls:redeploy -Dname=weblogic-deployment-example-1.0 -Dsource=target/weblogic-deployment-example-1.0.war[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:redeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [ l d l { ti d f lt li}]

$ mvn wls:redeploy -Dname=weblogic-deployment-example-1.0 -Dsource=target/weblogic-deployment-example-1.0.war[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:redeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [ l d l { ti d f lt li}][INFO] [wls:redeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: redeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -redeploy -name weblogic-deployment-example-1.0 -source target/weblogic-deployment-example-1.0.war<Jan 4 2012 4:52:46 PM PST> <Info> <J2EE Deployment SPI> <BEA 260121> <Initiating redeploy operation for application weblogic deployment example 1 0 [archive:

[INFO] [wls:redeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: redeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -redeploy -name weblogic-deployment-example-1.0 -source target/weblogic-deployment-example-1.0.war<Jan 4 2012 4:52:46 PM PST> <Info> <J2EE Deployment SPI> <BEA 260121> <Initiating redeploy operation for application weblogic deployment example 1 0 [archive:<Jan 4, 2012 4:52:46 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 3 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Task 3 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Target state: redeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------

<Jan 4, 2012 4:52:46 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 3 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Task 3 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Target state: redeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------[INFO] [INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:52:46 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------

[INFO] [INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:52:46 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------

26 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 27: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Undeploy$ mvn wls:undeploy -Dname=simple-maven-example-1.0[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:undeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------

$ mvn wls:undeploy -Dname=simple-maven-example-1.0[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:undeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [INFO] [wls:undeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: undeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -undeploy -name simple-maven-example-1.0<Jan 4, 2012 4:47:19 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, simple-maven-example-1.0 [archive: null], to

[INFO] [INFO] [wls:undeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: undeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -undeploy -name simple-maven-example-1.0<Jan 4, 2012 4:47:19 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, simple-maven-example-1.0 [archive: null], to configured targets.>Task 1 initiated: [Deployer:149026]remove application simple-maven-example-1.0 on AdminServer.Task 1 completed: [Deployer:149026]remove application simple-maven-example-1.0 on AdminServer.Target state: undeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL

configured targets.>Task 1 initiated: [Deployer:149026]remove application simple-maven-example-1.0 on AdminServer.Task 1 completed: [Deployer:149026]remove application simple-maven-example-1.0 on AdminServer.Target state: undeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:47:20 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------[INFO] Total time: 2 seconds[INFO] Finished at: Wed Jan 04 16:47:20 PST 2012[INFO] Final Memory: 9M/22M[INFO] ------------------------------------------------------------------------

27 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 28: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

W bL i M Pl iWebLogic Maven PluginProvisioning Demo

28 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 29: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Zip Distribution

• WebLogic is now available in ZIP formatavailable in ZIP format at only 164MB!

• The WebLogic Zip Distribution can beDistribution can be downloaded from OTN

29 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 30: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Installing the WebLogic Zip Distribution in your Local RepositoryLocal Repository

• The WebLogic ZIP Distribution must be available in your g ylocal repository or a remote repository

• Install the WebLogic ZIP Distribution into your local repository using the Maven install:install-file goal

$ mvn install:install-file -Dfile=wls1211_dev.zip -DgroupId=com.oracle.weblogic -DartifactId=wls-dev -Dpackaging=zip -Dversion=12.1.1.0

30 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 31: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Configuring the WebLogic Plugin Install goal

<plugins><plugin>

<groupId>com oracle weblogic</groupId>

<plugins><plugin>

<groupId>com oracle weblogic</groupId><groupId>com.oracle.weblogic</groupId><artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration><adminurl>t3://127 0 0 1:7001</adminurl>

<groupId>com.oracle.weblogic</groupId><artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration><adminurl>t3://127 0 0 1:7001</adminurl><adminurl>t3://127.0.0.1:7001</adminurl><user>weblogic</user><password>welcome1</password><domainHome>${project.build.directory}/domain</domainHome><artifactLocation>com oracle weblogic:wls-dev:zip:12 1 1 0</artifactLocation>

<adminurl>t3://127.0.0.1:7001</adminurl><user>weblogic</user><password>welcome1</password><domainHome>${project.build.directory}/domain</domainHome><artifactLocation>com oracle weblogic:wls-dev:zip:12 1 1 0</artifactLocation><artifactLocation>com.oracle.weblogic:wls-dev:zip:12.1.1.0</artifactLocation>

</configuration></plugin>

</plugins>

<artifactLocation>com.oracle.weblogic:wls-dev:zip:12.1.1.0</artifactLocation></configuration>

</plugin></plugins>

31 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 32: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: InstallC:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:installC:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:installg p j y p g p g p[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task-segment: [wls:install] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:install {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: install ++

g p j y p g p g p[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task-segment: [wls:install] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:install {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: install ++[INFO] ++====================================================================++[INFO] Installing com.oracle.weblogic:wls-dev:zip:12.1.1.0 into: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software[INFO] Installing the product, this may take some time.[INFO] Executing: [cmd:[C:\\Windows\\system32\\cmd.exe, /c, configure.cmd]][INFO] Process being executed, waiting for completion.[INFO] [exec] **************************************************[INFO] [exec] WebLogic Server 12c (12.1.1.0) Zip Configuration[INFO] [exec]

[INFO] ++====================================================================++[INFO] Installing com.oracle.weblogic:wls-dev:zip:12.1.1.0 into: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software[INFO] Installing the product, this may take some time.[INFO] Executing: [cmd:[C:\\Windows\\system32\\cmd.exe, /c, configure.cmd]][INFO] Process being executed, waiting for completion.[INFO] [exec] **************************************************[INFO] [exec] WebLogic Server 12c (12.1.1.0) Zip Configuration[INFO] [exec][INFO] [exec] MW_HOME: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software[INFO] [exec] JAVA_HOME: C:\wls1035\jdk160_24[INFO] [exec] **************************************************[INFO] [exec][INFO] [exec] 771 jar files are being unpacked.[INFO] [exec] Please wait, title bar will show progress ...[INFO] [exec][INFO] [exec] "ACLs are being setup for C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software Please wait..."

[INFO] [exec] MW_HOME: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software[INFO] [exec] JAVA_HOME: C:\wls1035\jdk160_24[INFO] [exec] **************************************************[INFO] [exec][INFO] [exec] 771 jar files are being unpacked.[INFO] [exec] Please wait, title bar will show progress ...[INFO] [exec][INFO] [exec] "ACLs are being setup for C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software Please wait..."[INFO] [exec][INFO] [exec] CLASSPATH=“…"[INFO] [exec][INFO] [exec] PATH=“…."[INFO] [exec][INFO] [exec] Your environment has been set.[INFO] [exec][INFO] [exec] BUILD SUCCESSFUL

[INFO] [exec][INFO] [exec] CLASSPATH=“…"[INFO] [exec][INFO] [exec] PATH=“…."[INFO] [exec][INFO] [exec] Your environment has been set.[INFO] [exec][INFO] [exec] BUILD SUCCESSFUL

32 | © 2011 Oracle Corporation

Proprietary and Confidential

[INFO] [exec] Total time: 0 seconds[INFO] [configure script] exit code: 0[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

[INFO] [exec] Total time: 0 seconds[INFO] [configure script] exit code: 0[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

Page 33: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Create Domain

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:create-domain[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls create domain] (aggregator st le)

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:create-domain[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls create domain] (aggregator st le)[INFO] task-segment: [wls:create-domain] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:create-domain {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: create-domain ++[INFO] ++====================================================================++

[INFO] task-segment: [wls:create-domain] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:create-domain {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: create-domain ++[INFO] ++====================================================================++[INFO] Domain creation script:readTemplate(r'C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software\wlserver\common\templates\domains\wls.jar')cd('/Security/base_domain/User/weblogic')set('Name', 'weblogic')set('Password' '***')

[INFO] Domain creation script:readTemplate(r'C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\Oracle\Software\wlserver\common\templates\domains\wls.jar')cd('/Security/base_domain/User/weblogic')set('Name', 'weblogic')set('Password' '***')set( Password , )writeDomain(r'C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain')[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

set( Password , )writeDomain(r'C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain')[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

33 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 34: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Start Server

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:start-server[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls start ser er] (aggregator st le)

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:start-server[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls start ser er] (aggregator st le)[INFO] task-segment: [wls:start-server] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:start-server {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: start-server ++[INFO] ++====================================================================++

[INFO] task-segment: [wls:start-server] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:start-server {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: start-server ++[INFO] ++====================================================================++.[INFO] Starting server in domain: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain[INFO] Check stdout file for details: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain\server-5223679401799187816.out[INFO] Process being executed, waiting for completion....[INFO] Server started successful

.[INFO] Starting server in domain: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain[INFO] Check stdout file for details: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain\server-5223679401799187816.out[INFO] Process being executed, waiting for completion....[INFO] Server started successful[INFO] Server started successful[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

[INFO] Server started successful[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

34 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 35: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: WLSTC:\maven-examples\weblogic-provisioning-example>mvn wls:wlst -DfileName=src\main\wlst\createDatasource.pyC:\maven-examples\weblogic-provisioning-example>mvn wls:wlst -DfileName=src\main\wlst\createDatasource.pyp g p g p py[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task-segment: [wls:wlst] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:wlst {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: wlst ++

p g p g p py[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task-segment: [wls:wlst] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:wlst {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: wlst ++[ ] p g[INFO] ++====================================================================++Connecting to t3://127.0.0.1:7001 with userid weblogic ...Successfully connected to Admin Server 'AdminServer' that belongs to domain 'domain'.

Warning: An insecure protocol was used to connect to theserver. To ensure on-the-wire security, the SSL port orAdmin port should be used instead.

[ ] p g[INFO] ++====================================================================++Connecting to t3://127.0.0.1:7001 with userid weblogic ...Successfully connected to Admin Server 'AdminServer' that belongs to domain 'domain'.

Warning: An insecure protocol was used to connect to theserver. To ensure on-the-wire security, the SSL port orAdmin port should be used instead.

Location changed to edit tree. This is a writable tree withDomainMBean as the root. To make changes you will need to startan edit session via startEdit().

For more help, use help(edit)

Starting an edit session ...Started edit session, please be sure to save and activate your

Location changed to edit tree. This is a writable tree withDomainMBean as the root. To make changes you will need to startan edit session via startEdit().

For more help, use help(edit)

Starting an edit session ...Started edit session, please be sure to save and activate yourp ychanges once you are done.Activating all your changes, this may take a while ...The edit lock associated with this edit session is releasedonce the activation is completed.Activation completed[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

p ychanges once you are done.Activating all your changes, this may take a while ...The edit lock associated with this edit session is releasedonce the activation is completed.Activation completed[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

35 | © 2011 Oracle Corporation

Proprietary and Confidential

[ ][INFO] Total time: 7 seconds[INFO] Finished at: Sat Jan 14 17:51:08 PST 2012[INFO] Final Memory: 19M/45M[INFO] ------------------------------------------------------------------------

[ ][INFO] Total time: 7 seconds[INFO] Finished at: Sat Jan 14 17:51:08 PST 2012[INFO] Final Memory: 19M/45M[INFO] ------------------------------------------------------------------------

Page 36: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

WebLogic Maven Plugin: Stop Server

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:start-server[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls start ser er] (aggregator st le)

C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example>mvn wls:start-server[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-provisioning-example[INFO] task segment [ ls start ser er] (aggregator st le)[INFO] task-segment: [wls:start-server] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:start-server {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: start-server ++[INFO] ++====================================================================++

[INFO] task-segment: [wls:start-server] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] [wls:start-server {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: start-server ++[INFO] ++====================================================================++.[INFO] Starting server in domain: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain[INFO] Check stdout file for details: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain\server-5223679401799187816.out[INFO] Process being executed, waiting for completion....[INFO] Server started successful

.[INFO] Starting server in domain: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain[INFO] Check stdout file for details: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-provisioning-example\target\domain\server-5223679401799187816.out[INFO] Process being executed, waiting for completion....[INFO] Server started successful[INFO] Server started successful[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

[INFO] Server started successful[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO] ------------------------------------------------------------------------

36 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 37: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

Ad d U fAdvanced Uses of WebLogic Server Maven Plugin

37 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 38: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Advanced Uses of WebLogic Maven Plugin

• Automating deployment parameters using Maven propertiesproperties

• Binding the WebLogic Plugin to Maven execution phases for automating Deployment & Provisioning operationsfor automating Deployment & Provisioning operations

• Using Maven Profiles for multiple deployment targets• Simplifying Configuration with Inheritance• Simplifying Configuration with Inheritance• Integration with Continuous Integration servers

38 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 39: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Automating Deployment Parameters

<plugin><plugin>

• Can make use Maven implicit properties to automatically set the parameter values based on project details

<plugin><groupId>com.oracle.weblogic</groupId><artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration>

<plugin><groupId>com.oracle.weblogic</groupId><artifactId>wls-maven-plugin</artifactId><version>12.1.1.0</version><configuration><configuration>

<middlewareHome>c:\wls1211</middlewareHome><adminurl>t3://127.0.0.1:7001</adminurl><user>weblogic</user><password>welcome1</password>

<configuration><middlewareHome>c:\wls1211</middlewareHome><adminurl>t3://127.0.0.1:7001</adminurl><user>weblogic</user><password>welcome1</password><password>welcome1</password><name>${project.build.finalName}</name><source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>

</configuration></plugin>

<password>welcome1</password><name>${project.build.finalName}</name><source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>

</configuration></plugin>

39 | © 2011 Oracle Corporation

Proprietary and Confidential

</plugin></plugin>

Page 40: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Automating Deployment Parameters$ mvn wls:deploy[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:redeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------

$ mvn wls:deploy[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building weblogic-deployment-example[INFO] task-segment: [wls:redeploy] (aggregator-style)[INFO] ------------------------------------------------------------------------[INFO] ------------------------------------------------------------------------[INFO] [wls:redeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: redeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -redeploy -name weblogic-deployment-example-

[INFO] ------------------------------------------------------------------------[INFO] [wls:redeploy {execution: default-cli}][INFO] ++====================================================================++[INFO] ++ wls-maven-plugin: redeploy ++[INFO] ++====================================================================++weblogic.Deployer invoked with options: -noexit -adminurl t3://127.0.0.1:7001 -user weblogic -redeploy -name weblogic-deployment-example-1.0 -source C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target/weblogic-deployment-example-1.0.war<Jan 4, 2012 4:58:31 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 5 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.

1.0 -source C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target/weblogic-deployment-example-1.0.war<Jan 4, 2012 4:58:31 PM PST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, weblogic-deployment-example-1.0 [archive: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-deployment-example\target\weblogic-deployment-example-1.0.war], to configured targets.>Task 5 initiated: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.[ p y ] p y pp g p y pTask 5 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Target state: redeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO]

[ p y ] p y pp g p y pTask 5 completed: [Deployer:149026]deploy application weblogic-deployment-example-1.0 on AdminServer.Target state: redeploy completed on Server AdminServer

[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL[INFO]

40 | © 2011 Oracle Corporation

Proprietary and Confidential

[INFO] ------------------------------------------------------------------------[INFO] ------------------------------------------------------------------------

Page 41: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Associating WebLogic tasks w/ Maven Phases• Maven plugin goals can be bound to a Maven phase to execute during that phase

• Useful for automating deployment of target application to a serverUseful for automating deployment of target application to a server for testing as part of Maven lifecycle

• Use the <executions> section of the <plugin> tag to specify the t t h d th l( ) t ttarget phase and the goal(s) to execute 

Pre‐Integration‐Test: install, create‐domain, start‐server, deploy

Integration‐Test: <exec tests>

Post‐Integration‐Test: undeploy, stop‐server, clean

41 | © 2011 Oracle Corporation

Proprietary and Confidential

g p y, p ,

Page 42: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Automatic Execution of Deployment Goals<executions><executions><executions>

<execution><id>deploy</id><phase>pre-integration-test</phase><goals><goal>deploy</goal>

<executions><execution><id>deploy</id><phase>pre-integration-test</phase><goals><goal>deploy</goal>nd

ing

</goals><configuration><source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> <name>${project.build.finalName}</name>

</configuration></execution>

</goals><configuration><source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> <name>${project.build.finalName}</name>

</configuration></execution>G

oal B

i

</execution>

<execution><id>undeploy</id> <phase>post-integration-test</phase><goals>

l d l / l

</execution>

<execution><id>undeploy</id> <phase>post-integration-test</phase><goals>

l d l / lPhas

e/G

<goal>undeploy</goal></goals><configuration><name>${project.build.finalName}</name>

</configuration></execution>

<goal>undeploy</goal></goals><configuration><name>${project.build.finalName}</name>

</configuration></execution>Pl

ugin

42 | © 2011 Oracle Corporation

Proprietary and Confidential

</executions></executions>

Page 43: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Automated Integration Testing with Deployment-------------------------------------------------------T E S T S-------------------------------------------------------Running servlets.AddingServletITStrings Match (PASS): 1+2=3 | 1+2=3Strings do not Match (PASS): 1+2=3 | 1+2=4

-------------------------------------------------------T E S T S-------------------------------------------------------Running servlets.AddingServletITStrings Match (PASS): 1+2=3 | 1+2=3Strings do not Match (PASS): 1+2=3 | 1+2=4Pl

ugin

Strings do not Match (PASS): 1+2 3 | 1+2 4Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

Strings do not Match (PASS): 1+2 3 | 1+2 4Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

safe

IT P

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent![INFO] [failsafe:verify {execution: default}][INFO] Failsafe report directory: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-integration-test-example\target\failsafe-reports[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent![INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent![INFO] [failsafe:verify {execution: default}][INFO] Failsafe report directory: C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-integration-test-example\target\failsafe-reports[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent![INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESSFUL

ven

Fails

[INFO] ------------------------------------------------------------------------[INFO] Total time: 3 seconds[INFO] Finished at: Fri Jan 06 12:03:21 PST 2012[INFO] Final Memory: 15M/37M[INFO] ------------------------------------------------------------------------C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-integration-test-example>

[INFO] ------------------------------------------------------------------------[INFO] Total time: 3 seconds[INFO] Finished at: Fri Jan 06 12:03:21 PST 2012[INFO] Final Memory: 15M/37M[INFO] ------------------------------------------------------------------------C:\weblogic-12c-user-examples\jeffrey.west\maven-examples\weblogic-integration-test-example>

Mav

43 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 44: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Automatic Execution of Deployment Goals$ mvn verify$ mvn verify$ y[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building demo-wls-maven[INFO] task-segment: [verify][INFO] ------------------------------------------------------------------------[INFO] [war:war {execution: default-war}]

$ y[INFO] Scanning for projects...[INFO] ------------------------------------------------------------------------[INFO] Building demo-wls-maven[INFO] task-segment: [verify][INFO] ------------------------------------------------------------------------[INFO] [war:war {execution: default-war}]D

eplo

y

[INFO] Packaging webapp[INFO] Assembling webapp[demo-wls-maven] in [/Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven][INFO] Processing war project[INFO] Copying webapp resources[/Users/sbutton/Projects/Java/demo-wls-maven/src/main/webapp][INFO] Building war: /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war[INFO] [null:deploy {execution: deploy}]weblogic Deployer invoked with options: noexit adminurl t3://localhost:7001 user weblogic deploy name demo wls maven source

[INFO] Packaging webapp[INFO] Assembling webapp[demo-wls-maven] in [/Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven][INFO] Processing war project[INFO] Copying webapp resources[/Users/sbutton/Projects/Java/demo-wls-maven/src/main/webapp][INFO] Building war: /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war[INFO] [null:deploy {execution: deploy}]weblogic Deployer invoked with options: noexit adminurl t3://localhost:7001 user weblogic deploy name demo wls maven source

Dat

ion

st weblogic.Deployer invoked with options: -noexit -adminurl t3://localhost:7001 -user weblogic -deploy -name demo-wls-maven -source /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war<Dec 1, 2010 4:35:08 PM CST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, demo-wls-maven [archive: /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war], to configured targets.> Task 24 initiated: [Deployer:149026]deploy application demo-wls-maven on myserver.Task 24 completed: [Deployer:149026]deploy application demo-wls-maven on myserver.Target state: deploy completed on Server myserver

weblogic.Deployer invoked with options: -noexit -adminurl t3://localhost:7001 -user weblogic -deploy -name demo-wls-maven -source /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war<Dec 1, 2010 4:35:08 PM CST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, demo-wls-maven [archive: /Users/sbutton/Projects/Java/demo-wls-maven/target/demo-wls-maven.war], to configured targets.> Task 24 initiated: [Deployer:149026]deploy application demo-wls-maven on myserver.Task 24 completed: [Deployer:149026]deploy application demo-wls-maven on myserver.Target state: deploy completed on Server myserver

Inte

gra

Tes

Target state: deploy completed on Server myserver[INFO] [null:undeploy {execution: undeploy}]weblogic.Deployer invoked with options: -noexit -adminurl t3://localhost:7001 -user weblogic -undeploy -name demo-wls-maven<Dec 1, 2010 4:35:09 PM CST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, demo-wls-maven [archive: null], to configured targets.> Task 25 initiated: [Deployer:149026]remove application demo-wls-maven on myserver.Task 25 completed: [Deployer:149026]remove application demo-wls-maven on myserver.

Target state: deploy completed on Server myserver[INFO] [null:undeploy {execution: undeploy}]weblogic.Deployer invoked with options: -noexit -adminurl t3://localhost:7001 -user weblogic -undeploy -name demo-wls-maven<Dec 1, 2010 4:35:09 PM CST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, demo-wls-maven [archive: null], to configured targets.> Task 25 initiated: [Deployer:149026]remove application demo-wls-maven on myserver.Task 25 completed: [Deployer:149026]remove application demo-wls-maven on myserver.U

ndep

loy

44 | © 2011 Oracle Corporation

Proprietary and Confidential

p [ p y ] pp yTarget state: undeploy completed on Server myserver

p [ p y ] pp yTarget state: undeploy completed on Server myserverU

Page 45: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Using Maven Profiles for Multiple sets of Environment ParametersEnvironment Parameters

<profile><id>deploy-local</id> <configuration>

< d i l>${ bl i D l d i l}</ d i l>p y

<properties><weblogic.Deployer.adminurl>t3://127.0.0.1:7001</weblogic.Deployer.adminurl><weblogic.Deployer.user>weblogic</weblogic.Deployer.user><weblogic.Deployer.password>welcome1</weblogic.Deployer.password><weblogic.Deployer.application.targets>AdminServer</weblogic.Deployer.application.targets>

</properties>

<adminurl>${weblogic.Deployer.adminurl}</adminurl><user>${weblogic.Deployer.user}</user><password>${weblogic.Deployer.password}</password><targets>${weblogic.Deployer.application.targets}</targets><remote>true</remote><upload>true</upload></properties>

</profile><profile><id>deploy-dev</id><properties><weblogic.Deployer.adminurl>t3://10.0.0.1:7001</weblogic.Deployer.adminurl>

p p<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source><name>${project.artifactId}</name>

</configuration>

<weblogic.Deployer.user>weblogic</weblogic.Deployer.user><weblogic.Deployer.password>welcome1</weblogic.Deployer.password><weblogic.Deployer.application.targets>AdminServer</weblogic.Deployer.application.targets>

</properties></profile>

$ mvn wls:deploy –P deploy-local$ mvn wls:deploy –P deploy-dev

45 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 46: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Simplifying Configuration with Inheritance

Holds common dependency & plugin configurationExamples: JDK 1.6, EE6 API’scommon

Holds common dependency and plugin configuration for projects that are deployable to WebLogic

common‐deployable

Holds Web Project, no additional configuration required to deploy to WebLogic

web‐project‐1

Holds Web Project, no additional configuration required to deploy to WebLogic

web‐project‐2

46 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 47: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

W bL i M &WebLogic, Maven & Continuous Integration

47 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 48: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Integration with Continuous Integration Servers

CI Server

Code Repository WebLogic

SCompile & Package

48 | © 2011 Oracle Corporation

Proprietary and Confidential

p yServerPackage

Page 49: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Several CI Servers are Free and Open Source

H dHudson

49 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 50: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Integration with Continuous Integration ServersHudson CI Server

• Dashboard displays status of all jobs

Hudson CI Server

• Builds automatically triggered from SCM changes

J b b t d di tl• Jobs can be created directly from a Maven project

• Maven “install” lifecycle used • Executes build, package, test,

integration-test phases

50 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 51: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Integration with Continuous Integration Servers

• Automatic deployment to WLS on SCM changeWLS on SCM change

• Integration tests run gagainst application on WLS

• Results reported as build status

51 | © 2011 Oracle Corporation

Proprietary and Confidential

status

Page 52: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Integration with Continuous Integration ServersTests executed against application deployed on WLSTests executed against application deployed on WLS

@Testpublic void calculatorServletError() throws Exception {@Testpublic void calculatorServletError() throws Exception {public void calculatorServletError() throws Exception {

int p1 = 1;int p2 = 2;int res = 0;

public void calculatorServletError() throws Exception {int p1 = 1;int p2 = 2;int res = 0;

String test = String.format("http://localhost:7001/demo-wls-

maven/CalculatorServlet?p1=%s&p2=%s", p1, p2);String expect = String.format("%s+%s=%s", p1, p2, res);

String test = String.format("http://localhost:7001/demo-wls-

maven/CalculatorServlet?p1=%s&p2=%s", p1, p2);String expect = String.format("%s+%s=%s", p1, p2, res);

final WebClient webClient = new WebClient();final HtmlPage page = webClient.getPage(test);final String pageAsText = page.asText();assertTrue(pageAsText.contains(expect));

}

final WebClient webClient = new WebClient();final HtmlPage page = webClient.getPage(test);final String pageAsText = page.asText();assertTrue(pageAsText.contains(expect));

}

52 | © 2011 Oracle Corporation

Proprietary and Confidential

}}

Page 53: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

J IDE d MJava IDEs and Maven

53 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 54: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

IDE Maven Support

• Most current IDE’s support MavenC F t• Common Features– Materialize projects from Maven POM– Dependency Integration with Compile / Test– Dependency Integration with Compile / Test

/ Run Classpath– Maven Repository Browsing– Multi-Module Maven Project Support– Form-based POM Editor

Dependency Graph

54 | © 2011 Oracle Corporation

Proprietary and Confidential

– Dependency Graph

Page 55: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Eclipse, OEPE and MavenMaven IDE Support

• Maven support in

Maven IDE Supporthttp://m2eclipse.sonatype.org/sites/m2e

• Maven support in Eclipse provided by the open-source M2Eclipse l i f S tplugin from Sonatype

• Install from M2Eclipse• Install from M2Eclipse update site

55 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 56: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Eclipse, OEPE and Maven – M2Eclipse Plugin Features• Creating and importing Maven projects• Dependency management and integration with the Eclipse

classpath

Features

classpath• Automatic dependency downloads and updates• Artifact Javadoc and source resolution• Creating projects with Maven ArchetypesCreating projects with Maven Archetypes• Browsing and searching remote Maven repositories• POM management with automatic update to dependency list• Materializing a project from a Maven POMg j• Adapting nested multi-module Maven projects to the Eclipse IDE• Form-based and text-based POM Editor• GUI Presentation of Dependency Tree and Resolved Dependencies

56 | © 2011 Oracle Corporation

Proprietary and Confidential

Source: http://m2eclipse.sonatype.org/index.html

Page 57: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Eclipse, OEPE and MavenWebLogic Maven Plugin

• Use wls-maven-pluginas per any other Maven

WebLogic Maven Plugin

as per any other Maven project

Add/ i l i i• Add/view plugin settings using POM editor

• Execute Maven builds call wls-maven-plugingoals

57 | © 2011 Oracle Corporation

Proprietary and Confidential

goals

Page 58: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

NetBeans and Maven

• NetBeans 6.7+ provides native support for Maven 2/3pp

• Create/Import Maven project• Manage dependencies• Dependency graph viewer• Run/Test projects

M it b• Maven repository browser• Can also push a Maven job directly

to a Hudson CI server as build job

58 | © 2011 Oracle Corporation

Proprietary and Confidential

j

Page 59: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

<Insert Picture Here>

O l S ft & P bliOracle Software & Public Maven Repositories

59 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 60: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

A Note on LicensingOracle Software & Public Maven Repositories

• Oracle Software has a license associated with it• In order to download the software from oracle com you must accept

Oracle Software & Public Maven Repositories

• In order to download the software from oracle.com you must accept the license agreement

• Public Maven Repo’s don’t enforce license acceptance• Options:

– Use a ‘System’ DependencyD l O l D d i t h d it b hi d fi ll– Deploy Oracle Dependencies to a shared repository behind your firewall

– Install Oracle JAR’s into your local repository

60 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 61: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

System-Scoped DependenciesManaging Oracle Maven Dependencies

• Refer to files on a locally accessible filesystem• Can be defined in a Parent POM file and reused by child projects

Managing Oracle Maven Dependencies

• Can be defined in a Parent POM file and reused by child projects• Middleware Home must be the same path on all machines or

property files must be used

<dependency><groupId>com.oracle.weblogic</groupId><artifactId>weblogic-spring</artifactId>artifactId weblogic spring /artifactId<version>12.1.1.0</version><scope>system</scope><systemPath>${middleware.home}\wlserver_12.1\server\lib\weblogic-spring.jar</systemPath>

</dependency>

61 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 62: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Manually Installed DependenciesManaging Oracle Maven Dependencies

• Install to your Local repository using the install:install-file goalDe elopment teams m st coordinate Gro p and Artifact ID’s

Managing Oracle Maven Dependencies

• Development teams must coordinate Group and Artifact ID’s

mvn install:install-file -DgroupId=com oracle weblogic -DartifactId=weblogic-spring -Dversion=12 1 1 0mvn install:install file DgroupId com.oracle.weblogic DartifactId weblogic spring Dversion 12.1.1.0 -Dpackaging=jar -Dfile=/wls1211/wlserver_12.1/server/lib/weblogic-spring.jar

<d d ><dependency><groupId>com.oracle.weblogic</groupId><artifactId>weblogic-spring</artifactId><version>12.1.1.0</version>

</dependency>

62 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 63: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Private RepositoriesManaging Oracle Maven Dependencies

• Create your own Maven Repository behind your corporate firewall using a tool like Apache Archiva

Managing Oracle Maven Dependencies

• Install Oracle dependencies using deploy:deploy-file

• Configure your private repository in your POM files

• Suggested approach for larger teams

mvn deploy:deploy-file -Durl=[url] -DrepositoryId=[id] -DgroupId=com.oracle.weblogic -DartifactId=weblogic-spring -Dversion=12.1.1.0 -Dpackaging=jar -Dfile=/wls1211/wlserver_12.1/server/lib/weblogic-spring.jar

<dependency><groupId>com.oracle.weblogic</groupId><artifactId>weblogic-spring</artifactId><version>12.1.1.0</version>

63 | © 2011 Oracle Corporation

Proprietary and Confidential

</dependency>

Page 64: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Summary

• Maven is a popular open source project lifecycle and build system that provides a very rich and dynamic set of features to help development teams

• Maven support introduced in WebLogic Server 11g R1 (10.3.4) and enhanced in 12c (12.1.1)

• WebLogic Maven Plugin can install the WebLogic Binaries, Create Domains,WebLogic Maven Plugin can install the WebLogic Binaries, Create Domains, Manage Server Lifecycle and Execute deployment operations against a target WebLogic Server instance

• Target server deployment operations can be seamlessly incorporated into theTarget server deployment operations can be seamlessly incorporated into the Maven lifecycle

• Maven has good support in the common Java IDEs

64 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 65: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Code ExamplesWebLogic Examples on Java net

• Code examples for Maven-WebLogic can be found here:http://java net/projects/weblogic examples/sources/weblogic 12c

WebLogic Examples on Java.net

– http://java.net/projects/weblogic-examples/sources/weblogic-12c-user-examples/show

– jeffrey.west / maven-examples

• You can also submit your own examples if you join the project!

65 | © 2011 Oracle Corporation

Proprietary and Confidential

Page 66: © 2011 Oracle Corporation Proprietary and Confidential€¦ · Understanding Apache Maven • An Apache open source project ... – The POM describes the project, its name/version,

Join the WebLogic CommunityO l / bl i

Twittertwitter com/oracleweblogic

Oracle.com/weblogic

twitter.com/oracleweblogic

Facebookfacebook.com/oracleweblogic

Oracle’s WebLogic blogblogs.oracle.com/weblogicserver

Y t bYoutubeYoutube.com/oracleweblogic

Developer Webcast Seriesl / / bl d

66 | © 2011 Oracle Corporation

Proprietary and Confidential

oracle.com/goto/weblogicdevcast