1

I have a maven project, and I have already all my dependencies in my local host. I want to push all these dependencies into nexus/sonartype.

I don't want to push my jar one by one by uploading via nexus interface.

So I copied the content of my maven repository ($MAVEN_HOME/repository) into {nexus-data}/storage/public

Nexus have to recalculate index after restarting?

Jeanne Boyarsky
  • 12,156
  • 2
  • 49
  • 59
Youssouf Maiga
  • 6,701
  • 7
  • 26
  • 42

2 Answers2

2

You might want to use Distribution Management -

<distributionManagement>
    <repository>
        <id>some-artifactory</id>
        <name>Artifactory Name</name>
        <url>http://your.artifactory.address/releases</url>
    </repository>
    <snapshotRepository>
        <id>other-artifactory</id>
        <name>Other Artifactory Name</name>
        <url>http://your.artifactory.address/snapshots</url>
    </snapshotRepository>
</distributionManagement>

Repository

Where as the repositories element specifies in the POM the location and manner in which Maven may download remote artifacts for use by the current project, distributionManagement specifies where (and how) this project will get to a remote repository when it is deployed. The repository elements will be used for snapshot distribution if the snapshotRepository is not defined.

Naman
  • 27,789
  • 26
  • 218
  • 353
2

So I copied the content of my maven repository ($MAVEN_HOME/repository) into {nexus-data}/storage/public

Don't do that. In Nexus 3, Nexus doesn't use raw files so relying on this approach isn't going to work for you anyway.

You should be using distribution management as described by @nullpointer. If you can't for some reason, you could write a script to use Nexus' REST API to upload many artifacts. That's more useful when you aren't building using Maven. For example, maybe you have a whole pile of legacy jar files to upload.

Jeanne Boyarsky
  • 12,156
  • 2
  • 49
  • 59