执行mvn deploy将jar工件推送到已安装的JBPM KIE Workbench时,我得到:返回代码为:401,ReasonPhrase:未经授权
服务器为什么不授予我访问权限?
要复制,请执行以下操作:
使用来自以下位置的docker映像安装新的Business Central安装(具有相应的jBPM Workbench 7.18.0.Final的KIE Server 7.18.0.Final):https://hub.docker.com/r/jboss/jbpm-server-full。启动网页http://localhost:8080/business-central/后访问并使用默认帐户wbadmin / wbadmin登录。
使用此POM创建一个新的示例Maven Java项目:
<?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>
将回购服务器的凭据添加到您的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>
...
现在使用部署目标构建Maven项目
mvn deploy
您收到错误消息:
[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]
通过Workbench Web-Frontend手动上传jar很好。
我还尝试在settings.xml配置中使用BASIC Auth,如此处所述:https://issues.jboss.org/browse/RHBRMS-2261,但也没有运气。
答案 0 :(得分:0)
问题是一个简单的错字:使用<id>jguvnor-m2-repo</id>
而不是<id>guvnor-m2-repo</id>
,以便它与settings.xml文件的ID相匹配。