About - Cpo Plugin 5.1.2-SNAPSHOT

convertsqltoxml goal

This goal will connect to an existing database, read your cpo config, and generate the cpo meta data xml file.

To use the cpo-plugin to create a XML meta data file from an existing CPO database configuration, run the following:

mvn org.synchronoss.cpo:cpo-plugin:5.1.2-SNAPSHOT:convertsqltoxml -DdbTablePrefix=prefix -DdbUrl=url

Replace prefix value with proper cpo table prefix for the database

Replace url value with the jdbc url for your database. The url should be in the format of: jdbc:oracle:thin:user/pass@host:port:instance (oracle example)

Optionally, you can also specify the following arguments:

  • dbDriver - The default is "oracle.jdbc.OracleDriver", so for non oracle instances, this should be specified
  • dbParams - for any database params that you might need, the format is exactly what you would have previously used w/ cpo util
  • filter - this allows you to only export a subset of classes, as opposed to all classes. The default expression for this is ".*" to match everything. Use regular expression syntax. An example might be "com\.mycompany\.mypackage.*" to match only classes that are in the com.mycompany.mypackage package and below.

The generated XML file will be placed in target/CpoMetaData.xml

generatejavasource goal

This goal can be used to generate the cpo bean classes at build time. It will generate the java source files, add them to the classpath, compile them and allow them to get packaged into your jar artifact.

To use the generatejavasource goal from the command line, run the following:

mvn org.synchronoss.cpo:cpo-plugin:5.1.2-SNAPSHOT:generatejavasource -DcpoConfig=config

Replace config with the location of your cpo meta data xml file

It's more likely that this goal will be included in the build/plugins section of your project's pom. To enable that configuration, here's an example:

      <plugin>
        <groupId>org.synchronoss.cpo</groupId>
        <artifactId>cpo-plugin</artifactId>
        <version>5.1.2-SNAPSHOT</version>
        <executions>
          <execution>
            <id>Build-CpoBeans</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generatejavasource</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <cpoConfig>${basedir}/src/main/resources/com/mycompany/mypackage/CpoMetaData.xml</cpoConfig>
        </configuration>
      </plugin>