Advertisements



SOA 12c – Using Maven for SOA deployment

In this post, we will see creation of SOA application/projects using the maven archetypes. And we will use local Maven Repository for the demonstration.

Navigate to %MW_HOME%\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3 and use following commands to sync your local repository:

mvn install:install-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=%MW_HOME%

Update your archetype catalog using:

mvn archetype:crawl -Dcatalog=C:\Users\<<uname>>\.m2\archetype-catalog.xml

Generate SOA Application and project as shown below. This generates SOA application test-soa-application with  project test-soa-project.

mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.my.test -DartifactId=test-soa-application -DprojectName=test-soa-project -Dversion=1.0-SNAPSHOT

Import this maven project in JDeveloper using File –> Import and select the Maven Project option as shown below. Click OK.

import1

Give your application directory as Root Directory which brings up all POMs and select other options as shown below. Click OK.

importmaven

Enter Application Name and click OK.

importappl

Click OK if you get any error related to overriding the existing project dialog so that jws file is created. Now your project explorer should look like as below.

importedprj

Open application level POM file in Application Resources directory as shown below and observe the details.

applpom1

applpom

Open project level POM file in Resources directory of SOA Project and observe the details.

projpom

Compile SOA Application using mvn compile (from directory of SOA Application).

compile

Modify server details in project level POM file as shown below and deploy your SOA projects using mvn pre-integration-test (from SOA application directory).

compilechng

After execution, you will see following output and also can observe the SOA project deployed to SOA server as shown below.

preintg

deployed

You can execute SOA Plugin goals in the following manner from the directory containing project POM file.

mvn com.oracle.soa.plugin:oracle-soa-plugin:compile

mvn com.oracle.soa.plugin:oracle-soa-plugin:sar

mvn com.oracle.soa.plugin:oracle-soa-plugin:deploy

mvn com.oracle.soa.plugin:oracle-soa-plugin:undeploy

You can observe goal prefix as oracle-soa, when you describe the SOA Plugin as shown below.

soagolaprefix

so you can execute all goals simply using this goal prefix as below.

mvn oracle-soa:compile

mvn oracle-soa:sar

mvn oracle-soa:deploy

mvn oracle-soa:undeploy

 

Note: Use double quotes in the maven commands like below if you are seeing the error mentioned in this link.

mvn install:install-file “-DpomFile=oracle-maven-sync-12.1.3.pom” “-Dfile=oracle-maven-sync-12.1.3.jar” “-DoracleHome=C:/Oracle/Middleware/FMW1213New”

Advertisements

13 Responses to “SOA 12c – Using Maven for SOA deployment”


  1. 1 yuyisbakery September 21, 2017 at 9:05 PM

    With the archetypes [BPEL]:

    oracle-soa-application
    oracle-soa-project

    No problem, these let me create the proyect, and make:
    mvn clean, compile, package. All is ok.

    But with these archetypes [OSB].

    Only let me: create the project and make:

    mvn clean, compile … the mvn package generate and ERROR and do not let generate the jar.

    oracle-servicebus-application
    oracle-servicebus-project

  2. 2 cesat September 21, 2017 at 9:04 PM

    With the archetypes [BPEL]:

    oracle-soa-application
    oracle-soa-project

    No problem, these let me create the proyect, and make:
    mvn clean, compile, package. All is ok.

    But with these archetypes [OSB].

    Only let me: create the project and make:

    mvn clean, compile … the mvn package generate and ERROR and do not let generate the jar.

    oracle-servicebus-application
    oracle-servicebus-project

  3. 3 ashwin September 22, 2016 at 4:13 PM

    do you have any blogs on how to deploy osb applications?

  4. 5 Atul Gupta September 14, 2016 at 2:59 PM

    Hi Siva,

    I am able to deploy my application using maven properly.

    While I am trying to deploy my application using Jenkins and Maven, I am getting following error. Can you please help me with this.

    Building in workspace C:\Users\atulgupt\.jenkins\workspace\sca-demo
    Updating https://scm-coconet.capgemini.com/svn/repos/oracleidp/BPEL/Trunk/test-soa-application at revision ‘2016-09-14T14:50:47.098 +0530’
    At revision 231

    No changes for https://scm-coconet.capgemini.com/svn/repos/oracleidp/BPEL/Trunk/test-soa-application since the previous build
    [sca-demo] $ cmd.exe /C “C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.maven_3.2.5\bin\mvn.bat clean install -X -Doracle.home=C:\Oracle\Middleware\Oracle_Home && exit %%ERRORLEVEL%%”
    Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T22:59:23+05:30)
    Maven home: C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.maven_3.2.5
    Java version: 1.8.0_92, vendor: Sun Microsystems Inc.
    Java home: C:\Program Files\Java\jdk1.8.0_92\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “dos”
    [INFO] Error stacktraces are turned on.
    [DEBUG] Reading global settings from C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.maven_3.2.5\conf\settings.xml
    [DEBUG] Reading user settings from C:\Windows\system32\config\systemprofile\.m2\settings.xml
    [DEBUG] Using local repository at C:\Windows\system32\config\systemprofile\.m2\repository
    [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Windows\system32\config\systemprofile\.m2\repository
    [INFO] Scanning for projects…
    [DEBUG] Extension realms for project org.my.test:test-soa-application:pom:1.0-SNAPSHOT: (none)
    [DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
    [ERROR] The build could not read 1 project -> [Help 1]
    org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
    [FATAL] Non-resolvable parent POM: Failure to find com.oracle.soa:test-soa-project:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and ‘parent.relativePath’ points at no local POM @ line 21, column 13

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:416)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:672)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:253)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    [ERROR]
    [ERROR] The project org.my.test:test-soa-project:1.0-SNAPSHOT (C:\Users\atulgupt\.jenkins\workspace\sca-demo\test-soa-project\pom.xml) has 1 error
    [ERROR] Non-resolvable parent POM: Failure to find com.oracle.soa:test-soa-project:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and ‘parent.relativePath’ points at no local POM @ line 21, column 13 -> [Help 2]
    org.apache.maven.model.resolution.UnresolvableModelException: Failure to find com.oracle.soa:test-soa-project:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:195)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:244)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:899)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:751)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:463)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:432)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:549)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:432)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:396)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:672)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:253)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.oracle.soa:test-soa-project:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:191)
    … 24 more
    Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.oracle.soa:test-soa-project:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    … 28 more
    [ERROR]
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
    [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
    Picked up JAVA_TOOL_OPTIONS: -Djava.vendor=”Sun Microsystems Inc.”
    Build step ‘Invoke top-level Maven targets’ marked build as failure
    Finished: FAILURE

  5. 8 mj June 21, 2016 at 12:07 PM

    Hi Siva ., i followed and i see this error ? Can you help

    I am using my local system only and enot sure why i am getting this error., do you ave any idea ?

    mvn install:install-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom

    – this worked BUILD SUCCESS

    mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=C:\Oracle\Middleware\Oracle_Home

    – this worked BUILD SUCCESS

    mvn archetype:crawl -Dcatalog=C:\Users\samy\.m2\archetype-catalog.xml
    – this worked BUILD SUCCESS

    When i try to create application and project ,,
    mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.my.test -DartifactId=test-soa-application -DprojectName=test-soa-project -Dversion=1.0-SNAPSHOT

    – this one is failing with following ERROR

    [DEBUG] Writing resolution tracking file C:\Users\samy\.m2\repository\com\oracle\soa\archetype\oracle-soa-application\12.1.3-0-0\oracle-soa-application-12.1.3-0-0.jar.lastUpdated

    [DEBUG] Archetype com.oracle.soa.archetype:oracle-soa-application:12.1.3-0-0 doesn’t exist
    org.apache.maven.archetype.downloader.DownloadException: Error downloading com.oracle.soa.archetype:oracle-soa-application:jar:12.1.3-0-0.

    FYI :

    this folder contains the only one .lastUpdated only

    C:\Users\samy\.m2\repository\com\oracle\soa\archetype\oracle-soa-application\12.1.3-0-0

    oracle-soa-application-12.1.3-0-0.jar.lastUpdated

    • 9 svgonugu June 21, 2016 at 1:16 PM

      This folder supposed to have .jar file and pom file pertaining to oracle-soa-application. Also did you check the contents of archetype-catalog.xml where the the list of archetypes are available? could you remove com directory from local repo and return the sync commands.

  6. 10 Venkat Meda December 29, 2015 at 12:05 PM

    Nice article on Maven integration with SOA 12c.

    This is good for single composite. Do you have any example for deploying the application (multiple composites)


  1. 1 SOA 12c – Maven Articles | Siva's Blog Trackback on September 1, 2015 at 11:36 AM
  2. 2 SOA 12c – Using Maven for SOA Projects deployment by Silva | SOA Community Blog Trackback on July 24, 2015 at 10:43 AM
  3. 3 SOA & BPM Community Newsletter March 2015 | SOA Community Blog Trackback on March 31, 2015 at 6:39 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Advertisements

Pages

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 349 other followers

Enter your email address to follow this blog and receive notifications of new posts by email.