'Maintaining different packages of different projects in a single repository

I would like to maintain all my java project's packages in a single repository. I'm using Github actions for this. I added the repository of the destination repo inside the pox.xml file.

    <profiles>
        <profile>
            <id>github</id>
            <activation>
                <property>
                    <name>useGitHubPackages</name>
                    <value>true</value>
                </property>
            </activation>
            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/******/test-platform</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <!-- We only need GitHub packages during releases as syncing to central is too slow. -->
            <id>github-releases</id>
            <repositories>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/*****/test-platform</url>
                </repository>
            </repositories>
        </profile>
</profiles>

I'm also using the settings.xml file and added the Personal Access Token as secrets to the repository. The token has scope as repo and write:packages. But when publishing the package I'm getting the following error. Anyone can help with this?

Error:  Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project demoproject: Failed to deploy artifacts: Could not find artifact com.example:demoproject:jar:3.0.1 in github (https://maven.pkg.github.com/*****/test-platform) -> [Help 1]

I would like to maintain the demoproject package inside the test-platform repository.

Thankyou.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source