Chapter 2. System integration with Maven
Chapter 2. System integration with Maven Red Hat Decision Manager is designed to be used with Red Hat JBoss Middleware Maven Repository and Maven Central repository as dependency sources. Ensure that both the dependencies are available for projects builds. Ensure that your project depends on specific versions of an artifact. LATEST or RELEASE are commonly used to specify and manage dependency versions in your application. LATEST refers to the latest deployed (snapshot) version of an artifact. RELEASE refers to the last non-snapshot version release in the repository. By using LATEST or RELEASE , you do not have to update version numbers when a new release of a third-party library is released, however, you lose control over your build being affected by a software release. 2.1. Preemptive authentication for local projects If your environment does not have access to the internet, set up an in-house Nexus and use it instead of Maven Central or other public repositories. To import JARs from the remote Maven repository of Red Hat Decision Manager server to a local Maven project, turn on pre-emptive authentication for the repository server. You can do this by configuring authentication for guvnor-m2-repo in the pom.xml file as shown below: <server> <id>guvnor-m2-repo</id> <username>admin</username> <password>admin</password> <configuration> <wagonProvider>httpclient</wagonProvider> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server> Alternatively, you can set Authorization HTTP header with Base64 encoded credentials: <server> <id>guvnor-m2-repo</id> <configuration> <httpHeaders> <property> <name>Authorization</name> <!-- Base64-encoded "admin:admin" --> <value>Basic YWRtaW46YWRtaW4=</value> </property> </httpHeaders> </configuration> </server> 2.2. Duplicate GAV detection in Business Central In Business Central, all Maven repositories are checked for any duplicated GroupId , ArtifactId , and Version (GAV) values in a project. If a GAV duplicate exists, the performed operation is canceled. Note Duplicate GAV detection is disabled for projects in Development Mode . To enable duplicate GAV detection in Business Central, go to project Settings General Settings Version and toggle the Development Mode option to OFF (if applicable). Duplicate GAV detection is executed every time you perform the following operations: Save a project definition for the project. Save the pom.xml file. Install, build, or deploy a project. The following Maven repositories are checked for duplicate GAVs: Repositories specified in the <repositories> and <distributionManagement> elements of the pom.xml file. Repositories specified in the Maven settings.xml configuration file. 2.3. Managing duplicate GAV detection settings in Business Central Business Central users with the admin role can modify the list of repositories that are checked for duplicate GroupId , ArtifactId , and Version (GAV) values for a project. Note Duplicate GAV detection is disabled for projects in Development Mode . To enable duplicate GAV detection in Business Central, go to project Settings General Settings Version and toggle the Development Mode option to OFF (if applicable). Procedure In Business Central, go to Menu Design Projects and click the project name. Click the project Settings tab and then click Validation to open the list of repositories. Select or clear any of the listed repository options to enable or disable duplicate GAV detection. In the future, duplicate GAVs will be reported for only the repositories you have enabled for validation. Note To disable this feature, set the org.guvnor.project.gav.check.disabled system property to true for Business Central at system startup:
<server> <id>guvnor-m2-repo</id> <username>admin</username> <password>admin</password> <configuration> <wagonProvider>httpclient</wagonProvider> <httpConfiguration> <all> <usePreemptive>true</usePreemptive> </all> </httpConfiguration> </configuration> </server> <server> <id>guvnor-m2-repo</id> <configuration> <httpHeaders> <property> <name>Authorization</name> <!-- Base64-encoded "admin:admin" --> <value>Basic YWRtaW46YWRtaW4=</value> </property> </httpHeaders> </configuration> </server> ~/EAP_HOME/bin/standalone.sh -c standalone-full.xml -Dorg.guvnor.project.gav.check.disabled=true