I use sbt
to publish new artifacts to a nexus-maven2 repository (my-maven-repo). The new artefacts appear in the nexus interface. Another sbt project uses these artefacts. When using exact requirements; he finds those, but when using a range; he fetches the list of available artifacts and that list is never up to date.
Methods / workarounds I have tried and their result:
curl -v -u user:pass -X DELETE http://my-server/nexus/service/local/metadata/repositories/my-maven-repo/content
(error: Http method DELETE is not supported by this URL )NOTES:
sbt
versions, this does not seem to be an sbt
issue; see related question
curl -X GET --header 'Accept: application/json' 'http://my-server/nexus/service/siesta/rest/beta/search?repository=my-maven-repo&name=mylib_2.12&version=2.4.0'
); but sbt
still does not find them when not specifying the exact version number.EDIT:
The incomplete list can be obtained using wget http://my-server/nexus/repository/my-maven-repo/org/company/mylib_2.12/maven-metadata.xml
EDIT2 upgrading to nexus-3.13 did not solve the problem.
The file at https://repo1.maven.org/maven2/com/octopus/randomquotes/maven-metadata.xml is created when a Maven artifact is published. It lists various details about the artifacts that have been published, like version number and the dates when the artifact was last updated.
I found a workaround using the new API present in nexus repository manager-3.13:
Repair - Rebuild Maven repository metadata (maven-metadata.xml)
)curl -v -u user:pass -X GET http://my-server/nexus/service/rest/v1/tasks
to get the id of this taskcurl -v -u user:pass -X POST http://my-server/nexus/service/rest/v1/tasks/c42ab5f5-4bd6-4ed3-b2f1-d061c24a9b90/run
to trigger the recreation of all maven-metadata.xmlDownsides:
sbt publish
to make sure maven-metadata.xml is up to dateIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With