How do I set up a proxy for this Maven2 repo? - Sonatype Nexus Repository - Sonatype Community

How do I set up a proxy for this Maven2 repo?

post by Chris_Fouts on Jan 27

Nexus v3.88.0

I created the following proxy in our hosted Nexus repository, shown in screen shot, and removed ALL mentions of https://repo.maven.apache.org/maven2/ in our build.gradle files and use the proxy setting instead. However, I still see this.

Download https://repo.maven.apache.org/maven2/io/springfox/springfox-swagger2/2.8.0/springfox-swagger2-2.8.0.pom

Download https://repo.maven.apache.org/maven2/org/springframework/spring-web/4.3.7.RELEASE/spring-web-4.3.7.RELEASE.pom

I see the other artifacts being downloaded from within our hosted Nexus repo, but not for the artifacts in the above Apache repo. Why is that?

post by mprescott on Jan 28

You didn’t say where you’re seeing these ‘Download’ messages, but I assume on your gradle CLI output. This is a sign that gradle is somehow misconfigured and not exclusively pointing to Nexus Repository.

post by jzora on Jan 28

Hi, Chris,

Two things to consider.

  1. Formatting in your build.gradle file should look like
   repositories {
       maven {
           url "https://nexus.example/repository/repository-name/"
       }
   }

or

   repositories {
       maven {
           credentials {
               username "$user"
               password "$password"
           }
           url "https://nexus.example/repository/repository-name/"
       }
   }

If your build.gradle file doesn’t look like this, correct that.

But I think that, if your build file was misconfigured, you’d be seeing errors as gradle reached out to an URL that didn’t exist. Instead, you’re still fetching a component so…

  1. Multi-module projects have multiple build.gradle files. I know this is basic, but can you confirm that you’ve configured the correct build file(s)?

Either way, I assume you’re a customer, so you have access to our Support team. If issues persist, open a ticket with them.

post by Chris_Fouts on Jan 28

I see them in my local terminal, for example, when I do a

$ ./gradlew clean build

I also see them in our Atlassian Bitbucket pipelines that runs a similar Gradle command.

post by Chris_Fouts on Jan 28

Sorry, I should’ve added that I created a Maven2 Group repository

https://<my-company-domain>/repository/my-maven-group/

and added my maven-apache proxy repository to the group, shown in screen shot.

In ALL of my build.gradle files, I then have

repositories {
    maven {
        credentials {
            username "$user"
            password "$password"
        }
        url "https://<my-company-domain>/repository/my-maven-group/"
    }
}

I also have this in my settings.gradle file

pluginManagement
  repositories {
      maven {
          credentials {
              username "$user"
              password "$password"
          }
          url "https://<my-company-domain>/repository/my-maven-group/"
      }
  }
}

post by jzora on Jan 29

Hmm. In that case, I can’t troubleshoot more without knowing the specifics of your configuration. If you’re a customer, open a ticket at support.sonatype.com and they can dive deeper into this with you.