Hi.

 

I've been using maven-ant-tasks to deploy an ant built library to a
local Nexus repository. The problem I have is that even though the ant
task is reading the settings .xml files, it doesn't appear to be using
the authentication info found there. I keep getting an authorization
failed message. So I hacked the ant build file to read in the username
and password from another file, but I don't like that solution.

 

I have found a fixed issue in Jira about ant tasks not reading the
settings.xml file (MANTASKS-6 specifically), but both the maven settings
and my local settings are being read. Just not being fully utilized, it
appears.

 

I find it hard to believe no one has run into this issue and that it
isn't already fixed, so I'm thinking I've configured something
incorrectly. Here's my configuration in my build.xml:

 

                <artifact:install-provider
groupId="org.apache.maven.wagon"

 
artifactId="wagon-webdav"

 
version="1.0-beta-2">

                </artifact:install-provider>

 

                <artifact:remoteRepository id="cwh"
url="dav:http://nexus-server:8081/nexus/content/repositories/releases";>

                                <releases enabled="true"/>

                                <snapshots enabled="false"/>

                </artifact:remoteRepository>

 

                <artifact:pom id="lang.pom" groupId="${maven.groupId}"
artifactId="${lang.artifactId}" version="${version}" packaging="swc"/>

                <artifact:writepom pomRefId="lang.pom"
file="lang-pom.xml"/>

                

                <artifact:deploy file="${lang.file}">

                    <pom file="lang-pom.xml"/>

                    <remoteRepository refid="cwh"/>

                    <attach file="${lang.linkreport}" type="xml"
classifier="linkreport"/>

                    <attach
file="${lang.build.dir}/${lang.name}-docs.zip" type="zip"
classifier="docs"/>

                </artifact:deploy>

 

 

And my settings file contains the typical server authentication for
id=cwh.

 

Has anyone else gotten this to work with this version of
maven-ant-tasks?

 

I did some digging in the code and it appears that the task doesn't pass
the authentication info on to the WagonManager. So I applied the
following patch and it seems to work now (although it doesn't deal with
encrypted passwords at all):

 

Index:
E:/development/maven-ant-tasks/src/main/java/org/apache/maven/artifact/a
nt/AbstractArtifactTask.java

===================================================================

---
E:/development/maven-ant-tasks/src/main/java/org/apache/maven/artifact/a
nt/AbstractArtifactTask.java                (revision 1182114)

+++
E:/development/maven-ant-tasks/src/main/java/org/apache/maven/artifact/a
nt/AbstractArtifactTask.java                (working copy)

@@ -437,6 +437,9 @@

             if ( server != null )

             {

                 repository.addAuthentication( new Authentication(
server ) );

+                WagonManager wagonManager = (WagonManager) lookup(
WagonManager.ROLE );

+                wagonManager.addAuthenticationInfo(repository.getId(),
server.getUsername(), server.getPassword(),

+
server.getPrivateKey(), server.getPassphrase());

             }

         }

 

If anyone can shed some light on this I'd greatly appreciate it. I'm not
sure my patch is the best way to go -- not dealing with encrypted
passwords, for example -- although it does provide a workaround for my
current problem. If it is, indeed, a code issue, I can open a Jira issue
for it.

 

Thanks,
Matt


______________________________________________________________________
This message, including any attachments, is confidential and contains 
information intended only for the person(s) named above. Any other 
distribution, copying or disclosure is strictly prohibited. If you are not the 
intended recipient or have received this message in error, please notify us 
immediately by reply email and permanently delete the original transmission 
from all of your systems and hard drives, including any attachments, without 
making a copy.

Reply via email to