cougar-codegen:process

Full name:

com.betfair.cougar:cougar-codegen-plugin:3.3-SNAPSHOT:process

Description:

A plugin which is responsible for generating Cougar-based services. This encompasses a number of code- and file-generation steps, as well as validation. The intention is for this mojo to do everything needed, keeping the plugins/plugin section of a Cougar service's pom as simple as possible.

NOTE: idd dependencies

IDDs can be read from the file system or as resources. The IDD is expected to be named after the service (see services param), suffixed with .xml for the service and -Extensions.xml for the extensions definition. If you're using an IDD file then it should be in /src/main/resources. Switch between the two modes using the iddAsResource flag.

A gotcha exists when accessing IDDs as resources. Since the IDDs are not required at run-time, it would make sense to include the relevant IDD project (jar) as a plugin dependency (ie. in project/plugins/plugin/dependencies as opposed to a project dependency of project/dependencies). You can do this unless your service is built as part of a larger project tree, in which multiple services are built. Maven resolves dependencies for the plugin once, so you can't have projectA relying on projectA-idd and project B relying on projectB-idd respectively - you end up with both projects relying on (say) projectA-idd. To work around this, you have to include the IDD as part of the project dependencies.

TODO If there's an easy way to fix this, we should do so (maven-savvy volunteers welcome)

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: runtime.
  • Binds by default to the lifecycle phase: generate-sources.

Required Parameters

Name Type Since Description
services Service[] - name of service.

Optional Parameters

Name Type Since Description
baseDir String - the base directory of the project
Default value is: ${basedir}.
client boolean - If set to true, generate a client version of generated code.
iddAsResource boolean - Read IDDs and files from the file system (as opposed to as resources). Use as transition for existing services, and also as a way to make writing/testing new services a bit simpler.
legacyExceptionParamValidation boolean - Legacy mode exception validation. Allows for an exception parameter to be called message. Note this is a nuisance as it obfuscates conventional exception class behaviour, so this method of operation should be phased out
offline boolean - Either mvn -o or in settings.xml
User property is: settings.offline.
server boolean - If set to true, generate a server version of generated code.

Parameter Details

baseDir:

the base directory of the project
  • Type: java.lang.String
  • Required: No
  • Default: ${basedir}

client:

If set to true, generate a client version of generated code.
  • Type: boolean
  • Required: No

iddAsResource:

Read IDDs and files from the file system (as opposed to as resources). Use as transition for existing services, and also as a way to make writing/testing new services a bit simpler.
  • Type: boolean
  • Required: No

legacyExceptionParamValidation:

Legacy mode exception validation. Allows for an exception parameter to be called message. Note this is a nuisance as it obfuscates conventional exception class behaviour, so this method of operation should be phased out
  • Type: boolean
  • Required: No

offline:

Either mvn -o or in settings.xml
  • Type: boolean
  • Required: No
  • User Property: settings.offline

server:

If set to true, generate a server version of generated code.
  • Type: boolean
  • Required: No

services:

name of service.
  • Type: com.betfair.cougar.codegen.Service[]
  • Required: Yes