Unable To Download JAR from GitHub Package Registry

I have two apps, one that is a jar and another that will use that jar as a dependency. I’ve followed all the instructions GitHub provided regarding GitHub package registry, but I am unable to access my jar from the dependent application.

I was able to deploy my jar file to GitHub package registry, but when I add the dependency,

<dependency>
        <groupId>com.{jar-name}</groupId>
	<artifactId>{jar-name}</artifactId>
	<version>0.0.1-snapshot</version>
</dependency>

,to the pom.xml of my app that will use this jar, I continue to get the following errors when running mvn install: 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project {app-name}: Compilation failure: Compilation failure:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/{username}/git/{app-name}/src/main/java/com/{app-name}/features/accountsettings/AccountSettingsService.java:[3,37] package com.{jar-name}.entity does not exist
[ERROR] /Users/{username}/git/{app-name}/src/main/java/com/{app-name}/features/accountsettings/AccountSettingsService.java:[7,39] cannot find symbol
  symbol: class AccountSettings
  location: interface com.{app-name}.features.accountsettings.AccountSettingsService

When I check the settings.xml, I am able to see that the .jar and .pom have downloaded. 

Below I have added the pom.xml files for my jar and other application. As well as my settings.xml file.

pom.xml for jar

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.4.RELEASE</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.{jar-name}</groupId>
	<artifactId>{jar-name}</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>{jar-name}</name>
	<description>{jar-name} Application</description>

	<distributionManagement>
		<repository>
			<id>github</id>
			<name>GitHub {owner} Apache Maven Packages</name>
			<url>https://maven.pkg.github.com/{owner}/{repo-name}</url>
		</repository>
	</distributionManagement>

	<properties>
		<java.version>1.8</java.version>
	</properties>


	<dependencies>
		<!-- Spring Boot -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- Lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>{jar-name}</id>
		</profile>
	</profiles>

</project>

pom.xml for dependent application

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.{app-name}</groupId>
	<artifactId>{app-name}</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>{app-name}</name>
	<description>Spring Boot Application</description>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.1.0.BUILD-SNAPSHOT</version>
		<relativePath /> <!-- lookup parent from repository -->
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>

	<dependencies>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<!-- Jar in Github Package Registry -->
		<dependency>
			<groupId>com.{jar-name}</groupId>
			<artifactId>{jar-name}</artifactId>
			<version>0.0.1-snapshot</version>
		</dependency>


		<!-- Lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.4</version>
			<scope>provided</scope>
		</dependency>

		<!-- Podam Factory -->
		<dependency>
			<groupId>uk.co.jemos.podam</groupId>
			<artifactId>podam</artifactId>
			<version>7.2.3.RELEASE</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.5.7</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.8</version>
		</dependency>


	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.{jar-name}</groupId>
				<artifactId>{jar-name}</artifactId>
        <version>0.0.1</version>
				<configuration>
					<mainClass>com.{jar-name}.{jar-main-class}</mainClass>
				</configuration>
			</plugin>
		</plugins>


	</build>

	<profiles>
		<profile>
			<id>{jar-name}</id>
		</profile>
	</profiles>


	<repositories>
		<repository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>spring-snapshots</id>
			<name>Spring Snapshots</name>
			<url>https://repo.spring.io/snapshot</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</pluginRepository>
		<pluginRepository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
	</pluginRepositories>


</project>

settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <activeProfiles>
    <activeProfile>{jar-name}</activeProfile>
  </activeProfiles>

  <profiles>
    <profile>
      <id>central</id>
      <repositories>
        <repository>
          <id>github</id>
          <url>https://repo1.maven.org/maven2</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
        <repository>
          <id>{jar-name}</id>
          <name>GitHub {owner} Apache Maven Packages</name>
          <url>https://maven.pkg.github.com/{owner}/{repo-name}</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>

      </repositories>
    </profile>
  </profiles>

  <servers>
    <server>
      <id>{jar-name}</id>
      <username>{owner}</username>
      <password>{token}</password>
    </server>
  </servers>
</settings>

I’ve thorougly read through the documentation, surfed the web for answers and tried the solution mentioned in other posts, but everything I’ve tried still results in the same errors.

Is there something that I am missing that is causing these errors?

Hi @developerdomjones ! Any luck with this issue?