0

I wrote the below code to upload artifact to nexus from Java.

    ProcessBuilder pb = new ProcessBuilder(
                "curl",
                "-v",
                "-F r=releases",
                "-F hasPom=true",
                "-F e=war",
                "-F file=/Users/test/workspace/test/pom.xml",
                "-F file=/Users/test/workspace/test/target/Test.war",
                "-u test:test1234",
                "http://localhost:28080/nexus/content");


        pb.redirectErrorStream(true);
        try {
            pb.start();
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

Doesnt seem to work. Any clue what is the mistake? I dont see an error in console as well.

Upen
  • 1,388
  • 1
  • 22
  • 49
  • Instead of curl have you considered using the maven commandline? See: http://stackoverflow.com/questions/4029532/upload-artifacts-to-nexus-without-maven/4036706#4036706 – Mark O'Connor Jul 08 '15 at 22:20
  • maven command line does not accept the repository usename and password as parameters. I have the restriction of not having a maven installed on the box. – Upen Jul 09 '15 at 16:37

1 Answers1

0

The URL is wrong, you should be using http://localhost:28080/nexus/service/local/artifact/maven/content

rseddon
  • 5,082
  • 15
  • 11