Nexus Mark Oracle Maven Repository as Invalid - nexus

Creating a Proxy repository on Nexus that proxies Oracle Maven Repo (http://download.oracle.com/maven/) marks the Oracle Repo as "Attempting to Proxy and Remote Unavailable"
The problem might be that Oracle disabled directory listing and every attempt to get the content without the full GAV returns a 404 code.
How to workaround this on Nexus?
Using Nexus OS Edition 1.9.2.2
Configuration:
Remote Storage Location = http://download.oracle.com/maven/
Download Remote Indexes = True
Auto Blocking Active = False
File Content Validation = True
CheckSum Policy = Warn

There should be no need to proxy the oracle repos, we've merged all of that content into Central now, so you can safely remove these from your Nexus.

The url you are using is wrong. Did you mean the java.net repo at http://download.java.net/maven/2/

Related

Python-Poetry Errors Publishing to Artifactory

I'm having a dickens of a time publishing to our Artifactory instance using poetry (1.1.12). I've tried a couple different URL's to publish to, and I either get a 405 (Method not Allowed), or a 415 (Unsupported Media Type)
https://my.domain/artifactory/my-cool-reg/ --> 405
https://my-cool-reg.my.domain/artifactory/api/pypi/pypi/simple/ -> 415
Is there some magic that I'm missing to get publishing going? I have tried passing my credentials both with -u and -p on the CLI, as well as with the credential config for the repository via -r my_repo. Below is an example error message (from the pypi url test)
UploadError
HTTP Error 415: Unsupported Media Type
at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/publishing/uploader.py:216 in _upload
212│ self._register(session, url)
213│ except HTTPError as e:
214│ raise UploadError(e)
215│
→ 216│ raise UploadError(e)
217│
218│ def _do_upload(
219│ self, session, url, dry_run=False
220│ ): # type: (requests.Session, str, Optional[bool]) -> None
geudrik - For the PyPI deployment, local configuration (.pypirc) should be defined with the API endpoint as http://pythonpublishtest.com/artifactory/api/pypi/test-pypi-local
/api/pypi is the required endpoint and the test-pypi-local I have mentioned in the URL here is the local repository. The reason for the HTTP 405 and HTTP 415 errors could be due to missing/incorrect API endpoint or the missing deployment repository.
I see that you are attempting to publish with the following URL (https://my-cool-reg.my.domain/artifactory/api/pypi/pypi/simple/). Could you please remove "simple" from the URI and include your PyPI local repository's name & verify if that works?
[Additional note]
Artifactory also supports the deployment of artifacts through the virtual repository. In order to enable it, we need to define the local repositories to be aggregated by the virtual repository as a target for deployment. It can be achieved by setting the Default Deployment Repository under the Virutal repository settings.
By gum, I've figured it out
$ poetry config repositories.poetry-repo-name https://artifactory.domain.lan/artifactory/api/pypi/your-cool-repository

SBT 1.1.1 not using credentials for Nexus proxy

We moved to a new authenticated Nexus to act as a proxy to get dependencies.
I've tried to to give SBT (1.1.1) the credentials it needs, in multiple ways, but I always endup getting :
[error] Unable to find credentials for [Sonatype Nexus Repository Manager # nexus3.company.com]
[debug] CLIENT ERROR: Unauthorized url=https://nexus3.company.com/repository/maven2-proxy-all/org/scala-sbt/actions_2.12/1.1.1/actions_2.12-1.1.1.pom
It's repeated for a lot of dependencies.
I've created a .credentials file in my project as follow:
realm=Sonatype Nexus Repository Manager
host=nexus3.company.com
user=xxxxx
password=xxxxx
Here's what I've tried, based on inputs I got from other threads on the internet:
Adding the path to this credentials file in the command : -Dsbt.boot.credentials=.credentials
Adding the path to this credentials file to an environment variable : $SBT_CREDENTIALS = PATH
Adding the following line in the build.sbt : credentials += Credentials(new File(".credentials"))
Adding the following line in the build.sbt : credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", "xxxxx", "xxxxxx")
Checking what's going on with a proxy : my requests don't seem to have any authorization header and all come back as HTTP 401
And yet, when I access the URL mentioned from the same machine, with the credentials in the file, there is no issue at all.
I'm running out of ideas here :(
After more attempts, adding :
~/.sbt/1.0/credentials.sbt
credentials += Credentials("Sonatype Nexus Repository Manager", "nexus3.company.com", USER, PWD)
AND
The SBT_CREDENTIALS variable mentioned above,
Seems to do the job.
I also updated the image we use for our pipelines, not sure if it helped.

Issue declaring the Nexus3 repositories as remote repositories in Artifactory

I am setting up Nexus3 repository as a remote repository in Artifactory.
But when I update the Nexus3 repo URL(https://domainname/repository/reponame/) & necessary credentials for authentication in the admin section, during testing i am getting,
Connection failed: Error 404.
I have tried providing the rest URL(http://domainname/service/rest/repository/browse/reponame).
In this case, connection to the nexus server establishes successfully & able to see the directory structure for the remote repo in the Artifacts section , but could not find the artifacts inside & seeing below output/error,
{ "errors" : [ {
"status" : 404,
"message" : "Couldn't find item: XXXX:XXXXXXX" } ]
You have to ignore the error while saving. This is because of a header mismatch.
Repo path should be like:
https://<host>:<port>/repository/reponame
Once you save the repository and try to download, it will work.
The test is failing when creating an Artifactory remote repository which point to a hosted Nexus repository, since Artifactory is using a HEAD request for checking the remote repository and for some reason Nexus will return a 404 (while returning a 200 when the same request is sent using the GET method). This behavior does not happen with Nexus group repositories.

proxy private docker registry using nexus 3

is it possible to proxy a private docker registry that runs on docker distribution using nexus oss 3?
i am able to successfully proxy the docker hub, however when i try to proxy my own internal registry, i just end up with image not found errors.
2016-08-31 15:58:21,457+0000 WARN [qtp331814152-140] admin org.sonatype.nexus.repository.docker.internal.V1Handlers - Error: GET /v1/repositories/company-npm/images: 404 - org.sonatype.nexus.repository.docker.internal.V1Exception$ImagesNotFound: images not found
2016-08-31 15:58:30,764+0000 WARN [qtp331814152-140] admin org.sonatype.nexus.repository.docker.internal.V2Handlers - Error: GET /v2/library/company-java/manifests/latest: 404 - org.sonatype.nexus.repository.docker.internal.V2Exception: manifest unknown
2016-08-31 15:58:30,811+0000 WARN [qtp331814152-51] admin org.sonatype.nexus.repository.docker.internal.V1Handlers - Error: GET /v1/repositories/company-java/images: 404 - org.sonatype.nexus.repository.docker.internal.V1Exception$ImagesNotFound: images not found
2016-08-31 15:58:46,379+0000 WARN [qtp331814152-164] admin org.sonatype.nexus.repository.docker.internal.V2Handlers - Error: GET /v2/library/company-java/manifests/6.0.0: 404 - org.sonatype.nexus.repository.docker.internal.V2Exception: manifest unknown
the documentation for the feature does not seem to indicate if this is supported.
I had this same issue with Nexus 3.0.1-01. For me the problem came down to namespacing. Nexus inserts the /library namespace for all repository access commands when a namespace is left blank. See https://books.sonatype.com/nexus-book/3.0/reference/docker.html section 9.8.
So for example if I push an image to a hosted repository:
docker push my-registry.com:5000/myimage:latest
The proxy registry looks for the image as:
docker pull my-registry.com:5000/library/myimage:latest
Which of course doesn't exist. (It would be really great if Nexus would add the /library namespace automatically on image push, or at least make this a configurable option at the repo level).
If you were to do the following:
docker push my-registry:5000/library/myimage:latest
or even:
docker push my-registry:5000/mynamespace/myimage:latest
The your proxy will be able to find the image.
docker pull my-proxy-registry:5000/mynamespace/myimage:latest

SBT not passing credentials when publishing to Artifactory

I am coding a Java project and I'm automating the build and the publishing to JFrog Artifactory using SBT.
Whenever it's time to publish to Artifactory I want to do it using the Ivy directory layout and obviously publish the Ivy XML file along with the jar. I managed to achieve this by using the following lines in the build.sbt file:
crossPaths := false
publishTo := Some("Artifactory Realm" at "http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my")
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishMavenStyle := false
However it only works when anonymous users are allowed to deploy into Artifactory. I realized that sbt is not really passing my credentials to Artifactory but, instead, logging in as anonymous.
My $HOME/.ivy2/.credentials file looks like this:
realm=Artifactory Realm
host=http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my
user=<my user name>
password=<my user name>
However, if I change the Artifactory configuration in order to prevent anonymous users from deploying new Artifacts, when I run "sbt publish" I get the following output:
[error] Unable to find credentials for [Artifactory Realm # <Artifactory IP>].
java.io.IOException: Access to URL http://<Artifactory IP>:<Artifactory Port>/artifactory//org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar was refused by the server: Unauthorized
The Artifactory request.log file then contains:
20160219011657|319|REQUEST|10.0.2.2|anonymous|PUT|/org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar|HTTP/1.1|401|24978
I have also tried passing the credentials manually instead of using a file:
credentials += Credentials("Artifactory Realm", "localhost", "<USERNAME>", "<PASS>")
But I am getting the same result.
Any idea what I might be missing?
try:
host=<Artifactory IP>
old answer (doesn't work):
host=<Artifactory IP>:<Artifactory port>
I had a different problem: I had the wrong realm set on my .credentials file.
Looking at the error output from sbt, I was able to figure out that I should use:
realm=Artifactory Realm
Error shows the expected values for realm and host:
[error] Unable to find credentials for [Artifactory Realm # myhost].

Resources