Maven "Could not find artifact" of <THIS PACKAGE> when "mvn deploy" to repository in Gitlab

Viewed 863

I'm trying to deploy a maven artifact to our self hosted Gitlab server. It is finding the server OK, but fails when trying to find the artifact I'm currently trying to upload.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project topic-lib: Failed to deploy artifacts: Could not find artifact com.company:topic-lib:jar:1.0.0 in gitlab-maven (http://git.company.no/groups/some/-/packages/maven) -> [Help 1]

Any idea what causes this error?

pom.xml

<?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.company</groupId>
    <artifactId>topic-lib</artifactId>
    <name>topic-lib</name>
    <description>topic-lib</description>
    <version>1.0.0</version>

    <properties>
        <java.version>15</java.version>
        <elasticsearch.version>7.6.2</elasticsearch.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.18</version>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.plugin</groupId>
            <artifactId>percolator-client</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>RELEASE</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>gitlab-maven</id>
            <url>http://git.company.no/groups/some/-/packages/maven</url>
        </repository>
    </repositories>
    <distributionManagement>
        <repository>
            <id>gitlab-maven</id>
            <url>http://git.company.no/groups/some/-/packages/maven</url>
        </repository>
        <snapshotRepository>
            <id>gitlab-maven</id>
            <url>http://git .company.no/groups/some/-/packages/maven</url>
        </snapshotRepository>
    </distributionManagement>
</project>

gitlab-ci.yml (basically https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Maven.gitlab-ci.yml with jdk15)

...

image: maven:3.6.3-openjdk-15

...

deploy:jdk15:
  stage: deploy
  script:
    - 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
  only:
    - master

ci_settings.xml file is gitlab's suggested file with "${env.CI_JOB_TOKEN}".

0 Answers
Related