You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.

This document explains how to configure the maven plugin to generate metamodel classes from your Blueriq model.

Getting started

Create a Maven project with, for example, the following POM:

pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.mycustomer</groupId>
	<artifactId>myproject-metamodel</artifactId>
	<version>1.0-SNAPSHOT</version>
	<name>myproject-metamodel</name>
	<properties>
		<com.blueriq.version>10.0-SNAPSHOT</com.blueriq.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>com.blueriq</groupId>
			<artifactId>blueriq-sdk</artifactId>
			<version>${com.blueriq.version}</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.blueriq</groupId>
				<artifactId>blueriq-metamodelgenerator-maven-plugin</artifactId>
				<version>${com.blueriq.version}</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>generate-metamodel</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<connections>
						<studio>
							<repository>MyRepository</repository>
							<branch>Trunk</branch>
							<project>MyProject</project>
							<destdir>src/main/java</destdir>
							<packageName>org.mycustomer.myproject.metamodel</packageName>
							<url>http://SERVER:PORT/Studio/Server/Services/ManagementService</url>
							<authentication>OIDC_CLIENT_CREDENTIALS</authentication>
                            <tokenUrl>http://SERVER:PORT/Keycloak/realms/BlueriqStudio17/protocol/openid-connect/token</tokenUrl>
                            <clientId>CLIENT_ID</clientId>
                            <clientSecret>CLIENT_SECRET</clientSecret>
							<exportProject>true</exportProject>
							<generatePojos>true</generatePojos>
							<generateRequiredMethods>true</generateRequiredMethods>
							<generateInstanceLocator>true</generateInstanceLocator>
 							<includeSystemEntityObjects>true<includeSystemEntityObjects> 
                        </studio>
						<offline>
							<applicationFile>${project.basedir}/MyProject.project.zip</applicationFile>
							<destdir>src/main/java</destdir>
							<packageName>org.mycustomer.myproject.metamodel</packageName>
							<generatePojos>true</generatePojos>
							<generateRequiredMethods>true</generateRequiredMethods>
							<generateInstanceLocator>true</generateInstanceLocator>
							<includeSystemEntityObjects>true</includeSystemEntityObjects>
                        </offline>
					</connections>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Configuration of the POM

You have to define the location of your Blueriq model(s) from which you will generate metamodel classes. The models can be retrieved directly from the Studio server or from an export. To define this, within the <connections> section you can add one or more <studio> (connection to Studio server) or <offline> (export) connections.

Studio server connection

ParameterDescriptionRequiredDefault value
repositoryName of the Blueriq repositoryYes
branchName of the Blueriq branchYes
projectName of the Blueriq projectYes
destdirDestination directory where all the java classes are storedYessrc/main/java
packageNameName of the base java packageYes
urlURL of the management service of the Studio serverYes
authentication

Authentication method. Since 17.9 BASIC, OIDC_CLIENT_CREDENTIALS and OIDC_PASSWORD are supported.

Note that BASIC is deprecated and may no longer be supported in a future version.

OIDC_PASSWORD most closely resembles BASIC, like BASIC it requires the username and password of a Studio user. In addition it also requires a tokenUrl, clientId and clientSecret which are used to request an access token on behalf of the user.

OIDC_CLIENT_CREDENTIALS offers an alternative to using the credentials of a regular user. It requires a tokenUrl, clientId and clientSecret. No username or password are required. To use this option, you must have created a client for the metamodel generator via User Management (Keycloak). Once that is done, you can connect to the Studio backend using only the client credentials of the metamodel generator client.

Yes
tokenUrlSince 17.9, the URL from which a token can be requested when using an OIDC authentication type, for example: STUDIO_URL/Keycloak/realms/BlueriqStudio17/protocol/openid-connect/tokenRequired when using an OIDC authentication type
clientIdSince 17.9, the id of the OIDC client when using an OIDC authentication typeRequired when using an OIDC authentication type
clientSecretSince 17.9, the secret of the OIDC client when using an OIDC authentication typeRequired when using an OIDC authentication type
usernameBlueriq username, since 17.9 renamed from "userName"Required when using BASIC or OIDC_PASSWORD
passwordBlueriq password, since 17.9 renamed from "passWord"Required when using BASIC or OIDC_PASSWORD
exportProjectSet to true if you want to generate the Blueriq project exportNofalse
exportProjectDir

Foldername to save the export

Notarget
generatePojosSet to true if you want to generate the POJO class of a Blueriq EntityNofalse
generateRequiredMethodsSet to true if you want to generate the getRequired<attribute> methodsNofalse
generateInstanceLocatorSet to true if you want to use the InstanceLocator classNofalse
includeSystemEntityObjectsSet to true if you want to add classes for system object like the system and user entityNofalse

Offline connection

This connection will pick up the given file name and presumes there is an export in it. It will then use the export to create the metamodel.

ParameterDescriptionRequiredDefault value
applicationFilePath of the export fileYes${project.basedir}/MyProject.project.zip
destdirDestination directory where all the java classes are storedYessrc/main/java
packageNameName of the base java packageYes
generatePojosSet to true if you want to generate the POJO class of a Blueriq EntityNofalse
generateRequiredMethodsSet to true if you want to generate the getRequired&tl;attribute> methodsNofalse
generateInstanceLocatorSet to true if you want to use the InstanceLocator classNofalse
includeSystemEntityObjectsSet to true if you want to add classes for system object like the system and user entityNofalse