Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-524

[GSS](6.3.z)Integration of KJAR Artifact Resolution with Profiles and Fabric Maven Proxy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • 6.3.1
    • 6.2.0
    • Fuse Integration
    • All All

    • CR1
    • Red Hat JBoss BPM Suite and Red Hat JBoss BRMS fail to integrate with the Fabricate environment due to incompatible loading methods of Maven repositories. There is currently no workaround.

    Description

      Description of problem:

      This issue relates to BRMS Integration with Fabric and more specifically to how Drools is loading KJARs from Maven.

      In this case, drools does not use the fabric maven proxy or any of the configured maven repo's in fabric to load a KJAR. It uses 3 potential methods;

      1) a drools CUSTOM_SETTINGS_PROPERTY pointing to a settings.xml
      2) the 'userHome + "/.m2/settings.xml"'
      3) the artifact is in 'userHome + "/.m2/repository"'

      This is because the KJAR is loaded by KIE specific logic and not as bundle loaded through a feature or profile. Because fabric customers manage resources and configurations through the fabric, this represents additional configuration that is hard to track and maintain.

      A KJAR is current loaded as follows;

      1) InternalKieModule kieModule = (InternalKieModule) getRepository().getKieModule(releaseId);
      https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieServicesImpl.java#L114

      2) return getKieModule(releaseId, null);
      https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L92

      3) kieModule = loadKieModuleFromMavenRepo(releaseId, pomModel);
      https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L105

      4) return getInternalKieScanner().loadArtifact(releaseId, pomModel);
      https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L129

      5) return internalKieScanner; -> InternalKieScanner
      https://github.com/droolsjbpm/drools/blob/6.3.x/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L133

      6) KieRepositoryScannerImpl implements InternalKieScanner
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/KieRepositoryScannerImpl.java

      7) getArtifactResolver();
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/KieRepositoryScannerImpl.java#L118

      8) mavenRepository = MavenRepository.getMavenRepository();
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/ArtifactResolver.java#L52

      9) defaultMavenRepository = new MavenRepository( defaultAether );
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/MavenRepository.java#L78

      10) remoteRepositoriesForRequest = initRemoteRepositoriesForRequest();
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/MavenRepository.java#L67

      11) final MavenRepositoryConfiguration repositoryUtils = getMavenRepositoryConfiguration();
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/MavenRepository.java#L87

      12) return MavenSettings.getMavenRepositoryConfiguration();
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/MavenRepository.java#L70

      13) return SettingsHolder.mavenConf;
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/embedder/MavenSettings.java#L49

      14) private static final MavenRepositoryConfiguration mavenConf = new MavenRepositoryConfiguration(settings);
      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/embedder/MavenSettings.java#L35

      In terms of artifact resolution, everything happens based on the configured maven settings above in step 14.

      For USER settings, it's looking for: private static File initUserSettingsFile()

      1) CUSTOM_SETTINGS_PROPERTY
      or
      2) File userSettingsFile = new File( userHome + "/.m2/settings.xml" );

      Otherwise it returns null.

      Then it initializes settings: private static Settings initSettings(File userSettingsFile)

      1) Is user settings wasn't null;
      request.setUserSettingsFile( userSettingsFile );

      2) Look for M2_HOME - set global settings
      File globalSettingsFile = new File( mavenHome + "/conf/settings.xml" );

      3) If user.home is set, sets the local repository:
      settings.setLocalRepository( userHome + "/.m2/repository" );

      Finlly;

      15) All of the repos from the found settings are initialized:

      this.extraRepositories = initExtraRepositories();
      this.remoteRepositoriesForRequest = initRemoteRepositoriesForRequest();
      this.artifactRepositoriesForRequest = initArtifactRepositories();

      https://github.com/droolsjbpm/drools/blob/6.3.x/kie-ci/src/main/java/org/kie/scanner/MavenRepositoryConfiguration.java#L43

      Version-Release number of selected component (if applicable):

      BRMS 6.2.x
      BRMS 6.3

      How reproducible:

      100%

      Steps to Reproduce:
      1. Deploy an application which loads a KJAR and only configure the maven repository or settings.xml in fabric.

      Actual results:

      KJAR artifact is unable to be found.

      Expected results:

      Should resolve and download the correct artifact.

      Additional info:

      In the customers eyes, in a fabric environment, drools should plug into fabric and leverage the already configured remote / local repositories configured within the environment.

      Attachments

        Issue Links

          Activity

            People

              pantinor@redhat.com Paolo Antinori
              rhn-support-mrobson Matt Robson
              Jiri Petrlik Jiri Petrlik
              Petr Penicka Petr Penicka (Inactive)
              Jiri Petrlik Jiri Petrlik
              Aileen Cunningham, Alessandro Lazarotti, Edson Tirelli, Lukáš Petrovický (Inactive), Marek Czernek (Inactive), Mario Fusco, Matt Robson, Rajesh Rajasekaran
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: