I'm using the latest maven ant tasks (2.0.10) from an old ant buildscript.
I'm trying to deploy (lightweight http wagon) a jar to our internal
artifact repository.
I have a very simple POM checked in (groupId, artifactId, version).
It works fine if I specify the authentication password in plaintext in
the ant script.
But I *don't* want to have the password checked in to the source code.

Instead, I am trying to define it in settings.xml.
My settings.xml works fine for deployments from maven, but not from ant.
I get a 401 error when I try to deploy.

settings.xml:

<settings>
  <servers>
    <server>
      <id>internalRepo</id>
      <username>myuser</username>
      <password>mypass</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <id>myprofile</id>
      <properties>
        <deployment.username>myuser</deployment.username>
        <deployment.password>mypass</deployment.password>
      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>abebooks-artifactory</activeProfile>
  </activeProfiles>
</settings>

I've added the following ant script:

<project name="deploy" default="mvn-deploy"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  <target name="mvn-deploy">
    <artifact:remoteRepository id="internalRepo" url="http://reposerver/path"; />
      <authentication username="${deployment.username}"
password="${deployment.password}" />
    </artifact:remoteRepository>
    <copy file="pom.xml.template" tofile="pom.xml">
      <filterset>
        <filter token="VERSION" value="${release.version.build}" />
      </filterset>
    </copy>
    <artifact:deploy file="${build.lib}/${legacy.jar}">
      <remoteRepository refid="internalRepo">
        <authentication username="${deployment.username}"
password="${deployment.password}" />
      </remoteRepository>
      <pom file="pom.xml">
        <profile id="myprofile"/>
      </pom>
    </artifact:deploy>
  </target>

As you can see, I've tried adding the authentication everywhere I can
think to do so.  I've also tried every variation on the above that I
can think of.  I am perpetually confronted with the following.

Error deploying artifact 'com.abebooks:legacy:jar': Error deploying
artifact: Failed to transfer file:
http://reposerver/path/ca/zac/legacy/8.11/legacy-8.11.jar. Return code
is: 401
        at 
org.apache.maven.artifact.ant.DeployTask.doExecute(DeployTask.java:144)
        at 
org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:678)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
...
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException:
Error deploying artifact: Failed to transfer file:
http://reposerver/path/ca/zac/legacy/8.11/legacy-8.11.jar. Return code
is: 401
        at 
org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:94)
        at 
org.apache.maven.artifact.ant.DeployTask.doExecute(DeployTask.java:123)
        ... 17 more
Caused by: org.apache.maven.wagon.TransferFailedException: Failed to
transfer file: http://reposerver/path/ca/zac/legacy/8.11/legacy-8.11.jar.
Return code is: 401
        at 
org.apache.maven.wagon.providers.http.LightweightHttpWagon.put(LightweightHttpWagon.java:172)
        at 
org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:245)
        at 
org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:161)
        at 
org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:80)
        ... 18 more

Is it possible to do what I am trying to do?  Is anyone else using
authentication from settings.xml?

Zac

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to