When building an Atlassian Jira plugin, Maven fails with the following error:
Artifact com.atlassian.pom:public-pom:pom:5.0.21 is present in the local repository,
but cached from a remote repository ID that is unavailable in current build context,
verifying that is downloadable from [maven-central (https://repo.maven.apache.org/maven2, default, releases+snapshots)]
Failed to read artifact descriptor for com.atlassian.maven.plugins:jira-maven-plugin:jar:8.1.2
Unknown packaging: atlassian-plugin
The settings.xml file contains a mirror configuration that redirects all repository requests to Maven Central:
<mirror>
<id>maven-central</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>*,!atlassian-local,!atlassian-public</mirrorOf>
</mirror>Key misconception: The mirrorOf parameter matches repository IDs, not artifact groupIds. So !atlassian-public excludes a repository with ID atlassian-public, not all com.atlassian.* artifacts.
The problem is that the profile defines repositories with different IDs:
atlassian-snapshotsmaven-atlassian-all-publicmaven-atlassian-all-closedsourceatlassian-proxy
These IDs are not excluded from the mirror, so Maven redirects requests for Atlassian artifacts to Maven Central, where they don't exist.
Edit settings.xml and add all Atlassian repository IDs to the exclusion list:
<!-- Before -->
<mirrorOf>*,!atlassian-local,!atlassian-public</mirrorOf>
<!-- After -->
<mirrorOf>*,!atlassian-local,!atlassian-public,!atlassian-snapshots,!maven-atlassian-all-public,!maven-atlassian-all-closedsource,!atlassian-proxy</mirrorOf>Check the _remote.repositories file in your local Maven repository:
cat ~/.m2/repository/com/atlassian/pom/public-pom/5.0.21/_remote.repositoriesOutput shows which repository IDs the artifact was downloaded from:
public-pom-5.0.21.pom>atlassian-proxy=
public-pom-5.0.21.pom>maven-atlassian-all-public=
These IDs must be excluded from the mirror.
After fixing settings.xml, rebuild:
atlas-mvn clean package- Always backup
settings.xmlbefore making changes - Use
-Xflag for debug output:atlas-mvn package -X - Use
-Uflag to force update cached artifacts:atlas-mvn package -U