We’ve all been there.
You want to achieve a goal, start looking up the appropriate documentation (after failing to find the solution yourself), en apply the documented fix.

And it fails.

That was where I found myself when I wanted to skip the deployment of an OSB 12c artifact when building it with maven.
The regular sequence of things is: package, deploy to server, (test), install to local maven repository, deploy to remote maven repository.
I want to skip the deployment to a running OSB-machine, as I don’t have one available in my setup.

The documentation doesn’t mention anything about skipping a phase, so I reverted to running help:describe on the plugin itself to gather more information.

mvn help:describe -Dplugin=com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0 –Ddetail

The output is below (emphasis mine):

[INFO] com.oracle.servicebus.plugin:oracle-servicebus-plugin:12.2.1-3-0

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.
  Implementation: oracle.sb.maven.plugin.DeployMojo
  Language: java

  Available parameters:

    configJar
      User property: configJar
      specifies a precompiler jar for deployment. requires setting of
      projectName

    customization
      User property: customization
      Specifies the location and name of a Service Bus configuration file that
      will update environment values for the environment in which the Service
      Bus archive is being deployed.

    oraclePassword
      Required: true
      User property: oraclePassword
      Specifies the administrative password.

    oracleServerUrl
      Required: true
      User property: oracleServerUrl
      Specifies the address and port on which the Administration Server is
      listening. The default value is: t3://localhost:7001

    oracleUsername
      Required: true
      User property: oracleUsername
      Specifies the administrative user name.

    projectName
      User property: projectName
      specifies the project name used for deployment with configJar option

    skip
      Setting skip as true will skip depolyment of sbar.

    useSSL (Default: false)
      User property: useSSL
      Enables the secure sockets layer (SSL) if passes as true.

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.
  Implementation: oracle.sb.maven.plugin.PackageMojo
  Language: java

  Available parameters:

    excludes
      Specifies a list of files to exclude from the project. Use this to
      exclude things like versioning system files.

    oracleHome
      Required: true
      User property: oracleHome
      Specifies the location to the Oracle Fusion Middleware home directory.
      You can specify this value as an expression.

    system (Default: false)
      Specifies whether the resources being packaged are system resources,
      which are shared by multiple projects within a Service Bus application.
      The default value is false. You must set this value to true when
      packaging system resources.

So there we have it! We just need to set -Dskip=true, and be done with it! Yay for documentation inside the plugin!

But, I was dealt a nope-card.
The plugin still tried to deploy my artifact halfway through, and failed miserably as I didn’t have a running server available.
Wait, what? So I followed the documentation inside the plugin, and it still failed?

So I turned to my trusty Java-decompiler, and cracked open the plugin. Mine is located at ~/.m2/repository/com/oracle/servicebus/plugin/oracle-servicebus-plugin/12.2.1-3-0.
The magic happens in the class oracle.sb.maven.plugin.DeployMojo, and shows as:

Knipsel

Success! Just add -Dosb.skip.deploy=true to your command, and you’re all set.
I ended up with:

mvn clean install -DoracleHome= -Dosb.skip.deploy=true

 

Houd jij je kennis graag up to date?

Mis niets meer van onze kennisdocumenten, events, blogs en cases: ontvang als eerste het laatste nieuws in je inbox!

Fijn dat we je op de hoogte mogen houden!