我正在使用maven-antrun-plugin
下载jre。如果我的配置是,我可以下载
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>artifactory-jre</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- download file -->
<get src="${download.url}/${download.file}${download.filePostfix}"
dest="${project.build.directory}/${download.file}${download.filePostfix}"
verbose="true"
usetimestamp="true"
username="user"
password="password123"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
但我不想在 pom
文件中提供用户名
和密码
,我尝试在设置中添加服务器条目.xml
类似
<server>
<username>user</username>
<password>password123</password>
<id>artifactory-jre</id>
</server>
但我遇到了以下异常。
[错误] 无法在项目 name.abuchen.zulu.jre.win32.x86_64 上执行目标 org.apache.maven.plugins:maven-antrun-plugin:1.8:run (artifactory-jre):An Ant BuildException 发生:HTTP 授权失败 [错误] 围绕 Ant 部分 ...... @ 4:315 在 C:\Users\Downloads\bundled-jre-master\bundled-jre-master\bundles\name.abuchen.zulu.jre.win32.x86_64\塔 rget\antrun\build-main.xml
如何在 Ant 中提供用户名和密码而不在 pom 文件中提供。
最佳答案
求解决方案。我在 setting.xml
中创建了属性,并在 pom.xml
我的setting.xml看起来像
<properties>
<user>user_name</user>
<password>my_password</password>
</properties>
在 pom.xml
中,我将此属性用作任何其他属性。
关于java - 发生 Ant BuildException : HTTP Authorization failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56792265/