3

My company uses Nexus as its internal repository, and I'm trying to write a Groovy script that will pull dependencies from it. The issue though is that this repository is password protected. What does my GrapeConfig.xml file have to look like to make this work? Here is what I currently have.

<ivysettings>
  <settings defaultResolver="downloadGrapes"/>
    <credentials host="http://prdRepo:18900" 
           realm="prdRepo" 
           username="n"
           passwd="n"
  />

  <resolvers>
    <chain name="downloadGrapes">
      <filesystem name="cachedGrapes">
        <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <ibiblio name="blahblah" root="http://http://prdRepo:18900/nexus/foo/bar/blahblah m2compatible="true"/>
    </chain>
  </resolvers>
</ivysettings>

And then when I try to install via the command line with

grape -d install com.microsoft msutil 2000

Which resides in that repository, it gives me a 401 error, unauthaorized URL. Could there be something syntactically wrong with my GrapeConfig?

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Steve
  • 4,457
  • 12
  • 48
  • 89

2 Answers2

3

Trying setting the security realm as follows:

<credentials host="prdRepo" realm="Sonatype Nexus Repository Manager" username="????" passwd="????"/>

For a working ivy example, see:

Additional notes:

Your ibiblio resolver is not well formed and the URL is invalid:

<ibiblio name="blahblah" root="http://http://prdRepo:18900/nexus/foo/bar/blahblah m2compatible="true"/>

Try:

<ibiblio name="blahblah" root="http://prdRepo:18900/nexus/foo/bar/blahblah" m2compatible="true"/>
Community
  • 1
  • 1
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
3

Since you're using http auth anyway, just change your URL to this. (password is being sent in plaintext.)

http://user:password@prdRepo:18900/nexus/foo/bar/blahblah

And delete the username/pass above.

avgvstvs
  • 6,196
  • 6
  • 43
  • 74