简体   繁体   中英

OSB project deployment to server with Maven

This is my first time working with Maven. I am trying to package and deploy an OSB project to weblogic server with Maven. But I am facing issues. Following are the steps done:

  1. Updated settings.xml with proxy setting and server setting.

  2. I have setup OSB (12.2.1.3) maven plugin with the following commands:

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

mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=ORACLE_HOME

  1. I created a simple OSB application with OSB project (Project to print "Hello World") in jdeveloper.

  2. I modified project pom.xml with properties tag for deployment to server. Please find below the project pom.xml:

     <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.oracle.servicebus</groupId> <artifactId>sbar-project-common</artifactId> <version>12.2.1-3-0</version> </parent> <groupId>MavenTest</groupId> <artifactId>MavenTest1</artifactId> <version>1.0-SNAPSHOT</version> <packaging>sbar</packaging> <build> <plugins> <plugin> <groupId>com.oracle.adf.plugin</groupId> <artifactId>ojdeploy</artifactId> <version>12.2.1-3-0</version> <configuration> <ojdeploy>${oracleHome}/jdeveloper/jdev/bin/ojdeploy.exe</ojdeploy> <workspace>${basedir}/../MavenTest.jws</workspace> <project>MavenTest1</project> <profile>MavenTest1</profile> <outputfile>${project.build.directory}/${project.build.finalName}.${project.packaging}</outputfile> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>deploy</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <properties> <oracleUsername>weblogicUN</oracleUsername> <oraclePassword>weblogicPW</oraclePassword> <oracleHome>Oracle_HomePath</oracleHome> <oracleServerUrl>http://localhost:7001</oracleServerUrl> </properties> </project> 
  3. Then I ran the following command from command line in the project directory where the project pom file exists:

mvn -e -X package

But I am getting the following error:

MAIN ERROR: [ERROR] Failed to execute goal com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0:package (default-package) on project MavenTest1: Creation of the Service Bus Configuration Archive failed. See the log in the build directory for more information. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0:package (default-package) on project MavenTest1: Creation of the Service Bus Configuration Archive failed. See the log in the build directory for more information.

Full Stack:

[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 31.835 s [INFO] Finished at: 2019-03-12T10:05:17+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0:package (default-package) on project MavenTest1: Creation of the Service Bus Configuration Archive failed. See the log in the build directory for more information. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0:package (default-package) on project MavenTest1: Creation of the Service Bus Configuration Archive failed. See the log in the build directory for more information. at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:28 8) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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.apache.maven.plugin.MojoFailureException: Creation of the Service Bus Configuration Archive failed. See the log in the build directory for more information. at oracle.sb.maven.plugin.PackageMojo.execute (PackageMojo.java:102) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apach e.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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] [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/MojoFailureException

  1. Also in MavenTest1.data\\maven\\configjar it is logging as C:\\Users\\userId\\AppData\\Local\\Microsoft\\WindowsApps was unexpected at this time.

  2. I have set in USER variables M2_HOME=C:\\Oracle\\Middleware\\Oracle_Home\\oracle_common\\modules\\org.apache.maven_3.2.5 , ORACLE_HOME=C:\\Oracle\\Middleware\\Oracle_Home, M2=%M2_HOME%\\bin , PATH=%path%;%M2%

In System Variables JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_202\\ , ORACLE_HOME=C:\\Oracle\\Middleware\\Oracle_Home , Path=%JAVA_HOME%\\bin , %ORACLE_HOME%\\oracle_common\\bin

Where am I going wrong?

The issue was resolved by following the below steps for Maven plug in provided by OSB with local repository: • In USER VARIABLES:

M2_HOME=C:\\Oracle\\Middleware\\Oracle_Home\\oracle_common\\modules\\org.apache.maven_3.2.5 M2=%M2_HOME%\\bin PATH=%path%;%M2%

• In SYSTEM VARIABLES:

JAVA_HOME=C:\\PROGRA~1\\Java\\jdk1.8.0_202\\ ORACLE_HOME=C:\\Oracle\\Middleware\\Oracle_Home Path=%JAVA_HOME%\\bin

• In settings.xml at C:\\Users\\.m2\\,

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository>C:\Users\(USERId)\.m2\repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline />
  <proxies>
    <proxy>
      <host>HostIP</host>
      <nonProxyHosts></nonProxyHosts>
    </proxy>
  </proxies>
</settings>

• Go to C:\\Oracle\\Middleware\\Oracle_Home\\oracle_common\\plugins\\maven\\com\\oracle\\maven\\oracle-maven-sync\\12.2.1 and run following commands:

  1. mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar [to install the Maven sync plug-in]
  2. mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=C:\\Oracle\\Middleware\\Oracle_Home [to seed the Oracle Service Bus development Maven plug-in into the Maven repository]
  3. mvn help:describe -DgroupId=com.oracle.servicebus.plugin -DartifactId=oracle-servicebus-plugin -Dversion=12.2.1-3-0 [To check if installation is success]

By executing the 3rd command. It should give below output:

Name: Oracle Service Bus - Plugin Description: The Oracle Service Bus development Maven plug-in provides Maven goals specific to the requirements of Service Bus projects and applications. You can use it to perform tasks such as packaging Service Bus projects or resources and deploying the package to a running server. Group Id: com.oracle.servicebus.plugin Artifact Id: oracle-servicebus-plugin Version: 12.2.1-3-0 Goal Prefix: servicebus

This plugin has 2 goals: servicebus:deploy Description: The deploy goal deploys Service Bus projects to a running server. This goal supports the Service Bus deployment format, SBAR. It does not require a local server installation. By default, deploying projects does not apply any updates to environment values. If you want to update the environment values, you can create a configuration file with the new environment values and specify that configuration file when you run deploy.

servicebus:package Description: The package goal creates a configuration JAR file from the resources associated with a POM file, and packages the resources into a Service Bus-specific archive file known as an .sbar file. By default, the Maven plug-in assumes the resources being packaged are project resources, but a Service Bus application can also include system resources, which are shared among projects. System resources are packaged differently than project resources, so when you package system resources, you need to set the system flag to true.

INSTALLATION IS A SUCCESS

To test with OSB project, create a simple OSB project like hello world. From command prompt go to application directory and run the below command to build and deploy project to osb server:

mvn install -DoracleServerUrl= http://localhost:7001 -DoracleUsername=username -DoraclePassword=password -DoracleHome=C:/Oracle/Middleware/Oracle_Home

The project will be build in .sbar format. The .sbar can be found in (D:(application)\\(project)\\.data\\maven\\ sbconfig.sbar). The .sbar will be deployed to OSB server.

Under D:(application)\\(project)\\.data\\maven\\configjar, there will be configjar text document which contains the log during the build. In case of any error, this file needs to be checked.

To clear previous build phase, exceute mvn clean, which will delete the .data\\maven directory which is the build directory.

The snapshots and .sbar artificats will also be stored in the local repository (C:\\Users\\(userId)\\.m2\\repository).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM