Hello, The Command Line I am now using is the following:
-jar tools\ivy\ivy.jar -ivy path/ivy.xml -settings path/ivysettings.xml -publishpattern C:\Dev\UtilityClasses/build/Artifact.Core.dll -revision 1.1.1 -publish url-archiva-internal -overwrite true I added a URL resolver to my ivysettings.xml because I was using ibiblio and, apparently, that does not handle publishing: http://ant.apache.org/ivy/history/latest-milestone/resolver/ibiblio.html This is what my URL resolver looks like: <url name="url-archiva-internal"> <ivy pattern="http://rep.company.com/archiva/repository/internal/[module]/[revision]/ivy-[revision].xml" /> <artifact pattern="http://rep.company.com/archiva/repository/internal/[module]/[revision]/[artifact]-[revision].[ext]" /> <artifact pattern="http://rep.company.com/archiva/repository/internal/[module]/[revision]/[artifact].[ext]" /> </url> When executing ivy with the above command line, I now get an authentication error: Exception in thread "main" java.io.IOException: Access to URL http:/ /rep.company.com/archiva/repository/internal/Artifact.Core/1.1.1/Artifact.Core-1.1.1.jar was refused by the server: Unauthorized So, at least I am able to attempt to access the proper URL to publish my artifact. My questions now are the following: - How does authentication work when publishing artifacts and what exactly needs to be done? Should I be using the http auth options and if so, with which credentials? How are they set? - The error message displays "Artifact.Core.jar" as my artifact name ([artifact]-[revision].[ext]). But the extension shouldn't be "jar", it should be "dll". How do I set this? For reference, here's the full exception stack trace: [exec] Exception in thread "main" java.io.IOException: Access to URL http://rep.company.com/archiva/re pository/internal/Artifact.Core/1.1.1/Artifact.Core-1.1.1.jar was refused by the server: Unauthorized [exec] at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:73) [exec] at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:206) [exec] at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82) [exec] at org.apache.ivy.util.FileUtil.copy(FileUtil.java:140) [exec] at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84) [exec] at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130) [exec] at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:226) [exec] at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:209) [exec] at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:282) [exec] at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:261) [exec] at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:170) [exec] at org.apache.ivy.Ivy.publish(Ivy.java:600) [exec] at org.apache.ivy.Main.run(Main.java:284) [exec] at org.apache.ivy.Main.main(Main.java:168) Thanks and Regards, - Georges -----Original Message----- From: Georges Labrèche [mailto:[email protected]] Sent: Tuesday, June 09, 2009 7:57 PM To: [email protected] Subject: Publishing An Artifact to Archiva From The Command Line Interface (CLI) Hello, I am trying to upload an artifact to an Archiva repository via the CLI. The reason I am using the CLI is because I am working on a .NET projects hence using NAnt build scripts. Using NAnt means that I do not have access to the convenient Ant ivy tasks such as <ivy:publish /> and must rely on executing the ivy.jar via NAnt's <exec /> task. Every sample I have stumbled upon publishes artifacts via the <ivy:publish /> task. I need to achieve the same thing but via the CLI. Looking and the -help output of ivy.jar I notice the following publishing options: ==== publish options -publish <resolvername> use given resolver to publish to -publishpattern <artpattern> use given pattern to find artifacts to publish -revision <revision> use given revision to publish the module -status <status> use given status to publish the module -overwrite overwrite files in the repository if they exist I have started experimenting with the following command line: -jar tools\ivy\ivy.jar -publishpattern C:\Dev\UtilityClasses/build/Artifact.dll -revision 1.1.1 This throws an error saying that the ivy file is not found. I'm not sure why it needs the ivy file when publishing an artifact. Can someone shed some light into this? Adding the -ivy option and pointing to the project's ivy file results in a success but not upload occurred. It only created a ivy-1.1.1.xml file ( a copy of ivy.xml) in my project's root folder. Also, when I manually upload an artifact to Archiva I need to input the following information: Group Id, Artifact Id, Version And Packaging (dll, in my case). I also tell Archiva to generate a Maven 2 POM file. How would I set all of these values via an ivy CLI publish? Other than revision for the version number, I don't seem to see options I can set which would relate to the information Archiva would expect upon an upload. Thanks and regards, - Georges
