【问题标题】:An Ant BuildException has occured: HTTP Authorization failure发生 Ant BuildException:HTTP 授权失败
【发布时间】:2019-07-08 22:01:10
【问题描述】:

我正在使用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 文件中提供usernamepassword,我尝试在settings.xml 中添加服务器条目,例如

   <server>
      <username>user</username>
      <password>password123</password>
      <id>artifactory-jre</id>
    </server>

但我遇到了以下异常。

[错误] 无法执行目标 org.apache.maven.plugins:maven-antrun-plugin:1.8:run (artifactory-jre) on project name.abuchen.zulu.jre.win32.x86_64: An发生 Ant BuildException:HTTP 授权失败 [错误] 围绕 Ant 部分......@ 4:315 在 C:\Users\Downloads\bundled-jre-master\bundled-jre-master\bundles\name.abuchen.zulu.jre.win32.x86_64\ ta rget\antrun\build-main.xml

如何在 Ant 中提供用户名和密码而不在 pom 文件中提供。

【问题讨论】:

标签: java maven ant


【解决方案1】:

对于解决方案。我在setting.xml 中创建了属性并在pom.xml 中使用了它

我的 setting.xml 看起来像

<properties>
<user>user_name</user>
<password>my_password</password>
</properties>

pom.xml 中,我将此属性用作任何其他属性。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-23
    • 2020-04-03
    • 2021-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多