java - 发生 Ant BuildException : HTTP Authorization failure

标签 java maven ant

我正在使用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/

相关文章:

android - 这种 Maven 依赖性从何而来?

java - 创建类路径资源 [spring/business-config.xml] 中定义的名称为 'entityManagerFactory' 的 bean 时出错

Java Swing JScrollPane 按住 Shift 并使用鼠标滚轮时不滚动

java - 如何在编辑文本聚焦时显示软键盘

java - 如何从我的项目中检索所有依赖项

java - Apache ant 排除文件集中的单个文件

java - apache ant 可变文件类型属性

java - Android 中未收到 USSD 代码的响应

java - 如何更新 "Practical Graph Analytics with Apache Giraph"示例以在当前 Cloudera Quickstart VM 上运行

java - 在 Nexus 中创建原型(prototype)目录