0
votes

I am using the kie-server docker image and sending curl commands to perform necessary actions.

In my settings.xml I am defining a remote repo as so:

<profiles>
    <profile>
      <id>kie</id>
      <properties>
      </properties>
      <repositories>
        <repository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Maven Repository Group</name>
          <url>http://mynexus:8081/nexus/content/repositories/releases</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
      ... plugin repo also set ...
</profiles>
<activeProfiles>
  <activeProfile>kie</activeProfile>
</activeProfiles>

When I try to create a container and define an artifact in the nexus repo, I get the following output:

09:29:35,236 WARN [org.appformer.maven.integration.embedder.MavenSettings] (default task-1) Environment variable M2_HOME is not set

09:29:36,033 INFO [org.appformer.maven.integration.Aether] (default task-1) The local repository directory /opt/jboss/.m2/repository doesn't exist. Creating it.

09:30:06,421 WARN [org.appformer.maven.integration.MavenRepository] (default task-1) Unable to resolve artifact: myGroup:myArtifact:0.0.1

09:30:36,542 ERROR [org.kie.server.services.impl.KieServerImpl] (default task-1) Error creating container 'myContainer' for module 'myGroup:myArtifact:0.0.1': java.lang.RuntimeException: Cannot find KieModule: myGroup:myArtifact:0.0.1

It looks like it is ignoring my remote repo settings and trying to use a local repo (and creating it first as it doesn't exist).

If I set a local maven repo and put the required artifact in there, the container creates fine and I can run the rules, so the rule/jar/container data are all ok.

I have checked the kie-server docker container once it's running, and the correct settings.xml file is in the /opt/jboss/.m2 folder which I believe is right.

Thanks in advance.

1
Hey, Neil! Did you figured out what was the problem?ilyailya

1 Answers

0
votes

I think the answer depends on how you're running the Kie Server image:

  • If using the official Red Hat image (registry-proxy.engineering.redhat.com/rh-osbs/rhpam-7-rhpam-kieserver-rhel8:7.7.1-1 as an example), you need to set MAVEN_REPO_URL, MAVEN_REPO_USERNAME and MAVEN_REPO_PASSWORD to configure your external Maven repository.

  • If using your own kie server image, you need to configure maven yourself in the Dockerfile, see example:

FROM openjdk:8-jdk-alpine

# Install Maven
RUN apk add --no-cache curl tar bash
ARG MAVEN_VERSION=3.6.3

RUN mkdir -p /usr/share/maven && \
  curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \
  ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV M2_HOME /usr/share/maven

# copy maven settings and repository
COPY my-maven-settings.xml /root/.m2/settings.xml

# copy application
COPY my-kieserver.jar /app.jar
# specify default command
CMD ["/usr/bin/java", "-Dkie.maven.settings.custom=/root/.m2/settings.xml", "-jar", "/app.jar"]

You can find a complete example about the latter in here (approach 1).