1

If I trying to upload a jar using command

mvn deploy:deploy-file \ 
-DgroupId=log4j \ 
-DartifactId=log4j-gwt \ 
-Dversion=1.0 \ 
-Dpackaging=jar \ 
-Dfile=log4j-gwt.jar \ 
-DrepositoryId=nexus \ 
-Durl=http://2.23.45.65:8081/nexus/content/repositories/central

I get error

Downloaded: http://2.23.45.65:8081/nexus/content/repositories/central/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar (0 B at 0.0 KB/sec)
Uploading: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.jar
Uploading: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.964s
[INFO] Finished at: Mon Mar 21 16:45:42 MSK 2016
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file (default-cli) on project gwtclient: Failed to deploy artifacts: Could not transfer artifact log4j:log4j-gwt:jar:1.0 from/to nexus (http://2.23.45.65:8081/nexus/content/repositories/central): Failed to transfer file: http://2.23.45.65:8081/nexus/content/repositories/central/log4j/log4j-gwt/1.0/log4j-gwt-1.0.jar. Return code is: 401

Bellow described how Nexus repository configured in the settings.xml

<mirror>
  <id>nexus</id>
  <url>http://2.23.45.65:8081/nexus/content/repositories/central/</url>
  <mirrorOf>central</mirrorOf>
</mirror>

Also I tried to configure groups/public repository. In settings.xml

  <server>
        <id>nexus_public</id>
        <username>username</username>
        <password>passwd</password>
        <filePermissions>664</filePermissions>
        <directoryPermissions>775</directoryPermissions>
        <configuration></configuration>
  </server>

In pom.xml

<repositories>
    <repository>
      <id>nexus_public</id>
      <url>http://2.23.45.65:8081/nexus/content/groups/public/</url>
    </repository>
</repositories>

And trying to run command

mvn deploy:deploy-file \
-DgroupId=log4j \ 
-DartifactId=log4j-gwt \ 
-Dversion=1.0 \ 
-Dpackaging=jar \ 
-Dfile=log4j-gwt.jar \
-DrepositoryId=nexus_public \ 
-Durl=http://2.23.45.65:8081/nexus/content/groups/public

But I get same error.

Also I tried to find Component Upload Tab as described in this article https://books.sonatype.com/nexus-book/reference/using-sect-uploading.html

But I couldn't find this tab in the Nexus Repository Manager OSS. This should be after the tab Summary, but it's not there.

ETartaren
  • 170
  • 3
  • 15
  • where did you find the jar `log4j-gwt` ? because i didn't find it in repository maven – Hohenheim Mar 21 '16 at 15:17
  • Based on the error message `Return code is: 401` i would assume your credentials or your configuration for that are not ok... – khmarbaise Mar 21 '16 at 15:40
  • @Hohenheim I didn't find log4j-gwt in maven repository too. I have downloaded it on https://sourceforge.net/projects/log4j-gwt/ – ETartaren Mar 21 '16 at 15:54
  • 1
    after configuring your network settings (proxy), if the jar is not present in maven repository : you got to put it in Nexus OSS manually in the 3rd party : you can refer to documents of sonatype concerning internal jars because i did it already for the jars which are not present in maven repository – Hohenheim Mar 21 '16 at 16:09
  • 1
    Your credentials may be wrong. You shouldn't upload to nexus/content/groups/public either -- create a repo for your project/team/company and use that. – Software Engineer Mar 21 '16 at 16:10
  • I have successfully uploaded in the 3rd party – ETartaren Mar 21 '16 at 18:25

2 Answers2

2

The problem is that you are trying to upload to a repository group. That wont work. You have to upload to a hosted repository.

Repository groups aggregate proxy and hosted repositories as a virtual merge. If you upload to a hosted repository that is part of the group - the artifact will be available in the group.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
1
-DrepositoryId=nexus

That is wrong, you need to use the ID of the server section in your settings.xml file that has your login credentials.

Try using:

-DrepositoryId=nexus_public

Also, I can't tell what kind of repository "central" is from your command, but by default Nexus ships with a a proxy repository named "central". You can't upload to proxy or group repositories, you can only upload to hosted repositories.

rseddon
  • 5,082
  • 15
  • 11