mavenjbpmkie-workbench

How to deploy a jar with Maven to JBPM Business Central?


When execute mvn deploy to push the jar artifact to the installed JBPM KIE Workbench I getting: Return code is: 401, ReasonPhrase: Unauthorized

Why does the Server did not grant me access?

To reproduce do following:

Install new Business Central Installation (KIE Server 7.18.0.Final with corresponding jBPM Workbench 7.18.0.Final) by using the docker image from here: https://hub.docker.com/r/jboss/jbpm-server-full. Access after startup the webpage http://localhost:8080/business-central/ and login with the default account: wbadmin/wbadmin.

Create a new sample Maven Java Project with this POM:

<?xml version="1.0" encoding="UTF-8"?>
<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>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <groupId>com.sample</groupId>
    <artifactId>project</artifactId>
    <version>1.0.0</version>
    <packaging>kjar</packaging>

    <distributionManagement>
        <!-- don't forget to add the server credentials to your settings.xml -->
        <repository>
            <id>jguvnor-m2-repo</id>
            <name>JBPM Workbench Repo</name>
            <url>http://localhost:8080/business-central/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.kie</groupId>
                <artifactId>kie-maven-plugin</artifactId>
                <version>7.18.0.Final</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>

Add the credentials for the repo server into your maven settings.xml

...
    <server>
        <id>guvnor-m2-repo</id>
        <username>wbadmin</username>
        <password>wbadmin</password>

        <configuration>
            <wagonProvider>httpclient</wagonProvider>
            <httpConfiguration>
                <all>
                    <usePreemptive>true</usePreemptive>
                </all>
            </httpConfiguration>
        </configuration>
    </server>
...

Now build the maven project with the deploy target

mvn deploy

You getting the error:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.618 s
[INFO] Finished at: 2019-05-05T13:07:39+02:00
[INFO] Final Memory: 42M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy (default-deploy) on project jbpmproject: ArtifactDeployerException: Failed to deploy artifacts: Could not transfer artifact com.sample:project:jar:1.0.0 from/to jguvnor-m2-repo (http://localhost:8080/business-central/maven2/): Failed to transfer file: http://localhost:8080/business-central/maven2/com/sample/project/1.0.0/project-1.0.0.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

Manual upload of jars via Workbench Web-Frontend works just fine.

I also tried to use BASIC Auth in settings.xml config like described here: https://issues.jboss.org/browse/RHBRMS-2261 But with no luck either.


Solution

  • The problem was a simple typo: instead of <id>jguvnor-m2-repo</id>, use <id>guvnor-m2-repo</id> so that this matches to the id of the settings.xml file.