Sunday, January 29, 2017

OSB 12c'de maven Kullanımı

Oracle Service Bus 12c ile birlikte Service Bus projelerini maven ile de yönetebiliyoruz. Bunun için başlangıçta Oracle Service Bus maven eklentilerinin oluşturulması gerekiyor. Bunu aşağıdaki adımları izleyerek gerçekleştirebilirsiniz:

export FMW_DEV_HOME=/u01/app/oracle/fmw_dev/12.1.3.0
export M2_HOME=$FMW_DEV_HOME/oracle_common/modules/org.apache.maven_3.0.5
export PATH=$M2_HOME/bin:$PATH

Oracle Service Bus maven eklentileri OSB 12c kurulumu ile geliyor:

[oracle@host1 ~]$ cd $FMW_DEV_HOME/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3
[oracle@host1 12.1.3]$ ls
oracle-maven-sync-12.1.3.jar  oracle-maven-sync-12.1.3.pom

Şimdi artık eklentiyi kurabiliriz:

[oracle@host1 12.1.3]$ mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -DoracleHome=$FMW_DEV_HOME
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/oracle-maven-sync-12.1.3.jar to /home/oracle/.m2/repository/com/oracle/maven/oracle-maven-sync/12.1.3-0-0/oracle-maven-sync-12.1.3-0-0.jar
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/oracle-maven-sync-12.1.3.pom to /home/oracle/.m2/repository/com/oracle/maven/oracle-maven-sync/12.1.3-0-0/oracle-maven-sync-12.1.3-0-0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.580s
[INFO] Finished at: Sun Jan 29 13:00:03 EET 2017
[INFO] Final Memory: 4M/120M
[INFO] ------------------------------------------------------------------------

mvn ile eklentiyi push ediyoruz:

[oracle@host1 12.1.3]$ mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=$FMW_DEV_HOME
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- oracle-maven-sync:12.1.3-0-0:push (default-cli) @ standalone-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] ORACLE MAVEN SYNCHRONIZATION PLUGIN - PUSH
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] Found 275 location files in /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven
[INFO] /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/com.sun.xml.bind.jaxb-core_2.2/12.1.3/com.sun.xml.bind.jaxb-core_2.2.12.1.3.location:
[INFO] com.oracle.weblogic:com.sun.xml.bind.jaxb-core_2.2:jar:12.1.3-0-0
   Update Time: 20140321062440
   POM File: /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/com.sun.xml.bind.jaxb-core_2.2/12.1.3/com.sun.xml.bind.jaxb-core_2.2.12.1.3.pom   Real File: /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/modules/com.sun.xml.bind.jaxb-core_2.2.jar
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/modules/com.sun.xml.bind.jaxb-core_2.2.jar to /home/oracle/.m2/repository/com/oracle/weblogic/com.sun.xml.bind.jaxb-core_2.2/12.1.3-0-0/com.sun.xml.bind.jaxb-core_2.2-12.1.3-0-0.jar
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/com.sun.xml.bind.jaxb-core_2.2/12.1.3/com.sun.xml.bind.jaxb-core_2.2.12.1.3.pom to /home/oracle/.m2/repository/com/oracle/weblogic/com.sun.xml.bind.jaxb-core_2.2/12.1.3-0-0/com.sun.xml.bind.jaxb-core_2.2-12.1.3-0-0.pom
[INFO] /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/org.glassfish.metro.metro-commons_2.3.1/12.1.3/org.glassfish.metro.metro-commons_2.3.1.12.1.3.location:
[INFO] com.oracle.weblogic:org.glassfish.metro.metro-commons_2.3.1:jar:12.1.3-0-0
   Update Time: 20140321063544
   POM File: /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/org.glassfish.metro.metro-commons_2.3.1/12.1.3/org.glassfish.metro.metro-commons_2.3.1.12.1.3.pom   Real File: /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/modules/org.glassfish.metro.metro-commons_2.3.1.jar
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/modules/org.glassfish.metro.metro-commons_2.3.1.jar to /home/oracle/.m2/repository/com/oracle/weblogic/org.glassfish.metro.metro-commons_2.3.1/12.1.3-0-0/org.glassfish.metro.metro-commons_2.3.1-12.1.3-0-0.jar
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/org.glassfish.metro.metro-commons_2.3.1/12.1.3/org.glassfish.metro.metro-commons_2.3.1.12.1.3.pom to /home/oracle/.m2/repository/com/oracle/weblogic/org.glassfish.metro.metro-commons_2.3.1/12.1.3-0-0/org.glassfish.metro.metro-commons_2.3.1-12.1.3-0-0.pom
[INFO] /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3/12.1.3/com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3.12.1.3.location:
[INFO] com.oracle.weblogic:com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3:jar:12.1.3-0-0
   Update Time: 20140506095648
   POM File: /u01/app/oracle/fmw_dev/12.1.3.0/wlserver/plugins/maven/com/oracle/weblogic/com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3/12.1.3/com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3.12.1.3.pom   Real File: /u01/app/oracle/fmw_dev/12.1.3.0/oracle_common/modules/com.oracle.webservices.wls.wls-soap-tool-jspgen_12.1.3.jar
. . . . . . . . . . . . . . . . . . . . . . . . . .[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/soa/plugins/maven/com/oracle/soa/sar-common/12.1.3-0-0/sar-common-12.1.3-0-0.pom to /home/oracle/.m2/repository/com/oracle/soa/sar-common/12.1.3-0-0/sar-common-12.1.3-0-0.pom
[INFO] Installing /u01/app/oracle/fmw_dev/12.1.3.0/soa/plugins/maven/com/oracle/soa/sar-common/12.1.3-0-0/sar-common-12.1.3-0-0.pom to /home/oracle/.m2/repository/com/oracle/soa/sar-common/12.1.3-0-0/sar-common-12.1.3-0-0.pom
[INFO] IMPORTANT NOTE
[INFO] This operation may have added/updated archetypes in your repository.
[INFO] To update your archetype catalog, you should run:
[INFO] 'mvn archetype:crawl -Dcatalog=$HOME/.m2/archetype-catalog.xml'
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.321s
[INFO] Finished at: Sun Jan 29 13:01:32 EET 2017
[INFO] Final Memory: 9M/210M
[INFO] ------------------------------------------------------------------------

Eklenti kurulumu tamamlandı. Artık kurulumu test edebiliriz:

[oracle@host1]$ mvn help:describe -DgroupId=com.oracle.servicebus.plugin -DartifactId=oracle-servicebus-plugin -Dversion=12.1.3-0-0
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-help-plugin:2.2:describe (default-cli) @ standalone-pom ---
[INFO] com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.1.3-0-0

Name: Oracle Service Bus - Plugin
Description: (no description available)
Group Id: com.oracle.servicebus.plugin
Artifact Id: oracle-servicebus-plugin
Version: 12.1.3-0-0
Goal Prefix: servicebus

This plugin has 2 goals:

servicebus:deploy
  Description: (no description available)

servicebus:package
  Description: (no description available)

For more information, run 'mvn help:describe [...] -Ddetail'

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.409s
[INFO] Finished at: Sun Jan 29 13:07:32 EET 2017
[INFO] Final Memory: 7M/120M
[INFO] ------------------------------------------------------------------------

Son olarak eklenti ile birlikte gelen archtype'ları yerel olarak archetype-catalog.xml dosyasına kaydettireceğiz:

[oracle@host1 ]$ mvn archetype:crawl -Dcatalog=$HOME/.m2/archetype-catalog.xml
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-archetype-plugin:2.4:crawl (default-cli) @ standalone-pom ---
[INFO] Scanning /home/oracle/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[INFO] Scanning /home/oracle/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-validator/commons-validator/1.2.0/commons-validator-1.2.0.jar
[INFO] Scanning /home/oracle/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[INFO] Scanning /home/oracle/.m2/repository/oracle/annotation/logging/logging-utils/1.0/logging-utils-1.0.jar
[INFO] Scanning /home/oracle/.m2/repository/net/sourceforge/jchardet/jchardet/1.0/jchardet-1.0.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar
[INFO] Scanning /home/oracle/.m2/repository/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/el/el-api/2.2/el-api-2.2.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/ws/rs/javax.ws.rs-api/2.0/javax.ws.rs-api-2.0.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/enterprise/cdi-api/1.1/cdi-api-1.1.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[INFO] Scanning /home/oracle/.m2/repository/javax/ejb/javax.ejb-api/3.2/javax.ejb-api-3.2.jar
[INFO] Scanning /home/oracle/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[INFO] Scanning /home/oracle/.m2/repository/jaxen/jaxen/1.1.6/jaxen-1.1.6.jar
[INFO] Scanning /home/oracle/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar

. . . . . . . . . . . . . 

[INFO] Scanning /home/oracle/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
[INFO] Scanning /home/oracle/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[INFO] Scanning /home/oracle/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
[INFO] Scanning /home/oracle/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
[INFO] Scanning /home/oracle/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
[INFO] Scanning /home/oracle/.m2/repository/asm/asm-analysis/3.2/asm-analysis-3.2.jar
[INFO] Scanning /home/oracle/.m2/repository/asm/asm-tree/3.2/asm-tree-3.2.jar
[INFO] Scanning /home/oracle/.m2/repository/asm/asm-util/3.2/asm-util-3.2.jar
[INFO] Scanning /home/oracle/.m2/repository/asm/asm-commons/3.2/asm-commons-3.2.jar
[INFO] Scanning /home/oracle/.m2/repository/asm/asm/3.2/asm-3.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.425s
[INFO] Finished at: Sun Jan 29 13:10:32 EET 2017
[INFO] Final Memory: 13M/419M
[INFO] ------------------------------------------------------------------------

Artık mvn ile OSB 12c projesi yaratabiliriz:

[oracle@host1 ]$ mvn archetype:generate -DarchetypeGroupId=com.oracle.servicebus.archetype -DarchetypeArtifactId=oracle-servicebus-project -DarchetypeVersion=12.1.3-0-0 -DgroupId=com.example -DartifactId=exercise -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [com.oracle.servicebus.archetype:oracle-servicebus-project:12.1.3-0-0] found in catalog local
[INFO] Using property: groupId = com.example
[INFO] Using property: artifactId = exercise
[INFO] Using property: version = 1.0-SNAPSHOT
[INFO] Using property: package = com.example
Confirm properties configuration:
groupId: com.example
artifactId: exercise
version: 1.0-SNAPSHOT
package: com.example
 Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: oracle-servicebus-project:12.1.3-0-0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: exercise
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: packageInPathFormat, Value: com/example
[INFO] Parameter: package, Value: com.example
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.example
[INFO] Parameter: artifactId, Value: exercise
[WARNING] Don't override file /home/oracle/Downloads/exercise/
[WARNING] Don't override file /home/oracle/Downloads/exercise/pom.xml
[INFO] project created from Archetype in dir: /home/oracle/Downloads/exercise
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.121s
[INFO] Finished at: Sun Jan 29 13:17:23 EET 2017
[INFO] Final Memory: 10M/129M
[INFO] ------------------------------------------------------------------------

Maven projesi üzerinde çalıştırabileceğimiz iki temel hedef bulunuyor: package ve pre-integration-test. mvn komutuna package hedefini vererek sbar dağıtım dosyası oluşturuyoruz:

[oracle@host1 PaymentValidationServiceBusApp]$ mvn package -DoracleServerUrl=http://localhost:7101 -DoracleUsername=weblogic -DoraclePassword=welcome1 -DoracleHome=$FMW_DEV_HOME
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] System
[INFO] PaymentValidationServiceBusApp
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building System 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- oracle-servicebus-plugin:12.1.3-0-0:package (default-package) @ System ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building PaymentValidationServiceBusApp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] System ............................................ SUCCESS [1:07.542s]
[INFO] PaymentValidationServiceBusApp .................... SUCCESS [0.000s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:08.974s
[INFO] Finished at: Sun Jan 29 14:09:21 EET 2017
[INFO] Final Memory: 11M/220M
[INFO] ------------------------------------------------------------------------

Bir uygulama sunucusuna dağıtım için ise pre-integration-test hedefini veriyoruz:


[oracle@host1 PaymentValidationServiceBusApp]$ mvn pre-integration-test -DoracleServerUrl=http://localhost:7101 -DoracleUsername=weblogic -DoraclePassword=welcome1 -DoracleHome=$FMW_DEV_HOME
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building PaymentValidation 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- oracle-servicebus-plugin:12.1.3-0-0:package (default-package) @ PaymentValidation ---
[INFO] 
[INFO] --- oracle-servicebus-plugin:12.1.3-0-0:deploy (default-deploy) @ PaymentValidation ---
[INFO] Service Bus Archive deployed using session Service_Bus_Maven-PaymentValidation-1485693304926.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:28.151s
[INFO] Finished at: Sun Jan 29 14:35:08 EET 2017
[INFO] Final Memory: 15M/220M
[INFO] ------------------------------------------------------------------------

Dağıtımın başarılı olduğunu Enterprise Manager'dan izleyebiliriz:




No comments:

Post a Comment