1

I am using maven-antrun-plugin to download jre. I can download if my configuration is

            <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>

but I do not wants to provide the username and password in pom file, I tried adding server entry in the settings.xml like

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

but I am getting following exception.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (artifactory-jre) on project name.abuchen.zulu.jre.win32.x86_64: An Ant BuildException has occured: HTTP Authorization failure [ERROR] around Ant part ...... @ 4:315 in C:\Users\Downloads\bundled-jre-master\bundled-jre-master\bundles\name.abuchen.zulu.jre.win32.x86_64\ta rget\antrun\build-main.xml

How can I supply username and password in Ant without being provided in pom file.

Ashish
  • 14,295
  • 21
  • 82
  • 127
  • https://stackoverflow.com/questions/7513319/passing-command-line-arguments-from-maven-as-properties-in-pom-xml/7515282 – guleryuz Jul 07 '19 at 13:58

1 Answers1

0

For the solution. I created property in setting.xml and used that in pom.xml

my setting.xml looks like

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

in pom.xml I used this property as any other property.

Ashish
  • 14,295
  • 21
  • 82
  • 127