1

We have a central, company-wide Repository Manager (Nexus OSS), that works as a mirror for central and also holds our repositories "releases" and "snapshots". We have defined a group "public" which contains all repositories.

The pom.xml's for all projects only contain the "DistributionManagement"-element and no "repositories"-element because we have a lot of projects that use the same repo manager. So instead we want to define a settings.xml on our CI/CD-agents that have all neccessary informations. So far we've tried using a mirror, with "mirrorsOf" set to "*". We wanted to keep it as simple as possible so we didn't define a profile:

<mirror>
    <id>nexus</id>
    <mirrorOf>*</mirrorOf>
    <url>https://nexusurl/nexus/repository/public/</url>
</mirror>

Now we get errors from builds that try to download dependencies but unable to find them:

Failed to execute goal on project example-project: Could not resolve dependencies for project group:project:jar:version: Could not find artifact group2:project2:jar:version-SNAPSHOT -> [Help 1]

When using a profile with the following configuration:

<profile>
    <id>nexus</id>
    <repositories>
         <repository>
            <id>nexus</id>
            <name>nexus</name>
            <url>https://nexusurl/nexus/repository/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
</profile>

The mirror and the repository both use the same group in the Nexus OSS, so i can't wrap my head around why one works and the other doesn't.

Does Maven need the "repositories"-element to even apply the mirror? I would assume it can't apply the mirror if it doesn't even know what repository it is supposed to mirror?

Edit: Probably important info - It doesn't seem to crash with every dependency, mostly with company-internal dependencies, we've tracked them down in the Nexus OSS and they seem to be just fine and avaiable. We upload them specifically to the releases/snapshots-repositories, though download all from public. Is that maybe an issue too?

Julian
  • 109
  • 9

0 Answers0