当执行MVN部署以将Jar伪像推到已安装的JBPM Kie Workbench i时:返回代码为:401,conasophrase:未经授权
为什么服务器不授予我访问?
重现以下内容:
通过从此处使用Docker Image:https://hub.docker.com/r/jboss/jboss/jbpm-----服务器满。启动后访问网页http://localhost:8080/business-central/lotaunt/login带有默认帐户: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>
将repo服务器的凭据添加到您的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手动上传罐子的工作正常。
我还尝试在settings.xml config中使用基本auth.xml config,如下所述:https://issues.jboss.org/browse/browse/rhbrms-2261,但没有运气。
问题是一个简单的错字:而不是<id>jguvnor-m2-repo</id>
,使用<id>guvnor-m2-repo</id>
,以便与settings.xml文件的ID匹配。