Artifactory : Not able to publish artifacts (even not anonymously)

51 Views Asked by At

I am using artifactory

Artifactory OSS 6.23.42 rev 62342900

I am using maven :

Apache Maven 3.9.4 

I am deplying it via gitlab and i have configured runner successfully using Shell executer and things are working. The only thing pending is communicating it with Artifactory.

Following is 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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.tiery.integrator.banking</groupId>
    <artifactId>gitlab-to-wildfly</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>gitlab-to-wildfly</name>
    <description>gitlab-to-wildfly</description>

    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>10.0.0</version>
        </dependency>
    </dependencies>
    
    <profiles>
        <!-- WildFly 27 profile -->
        <profile>
            <id>wildfly27</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

            <properties>
                <version.java>11</version.java>
                <version.ejb>3.2</version.ejb>
                <version.ear>7</version.ear>
                <artifact.classifier>wildfly27</artifact.classifier>

                <!-- WildFly Maven Plugin Settings -->
                <wildfly27.deploy.filename>${project.build.finalName}.${project.packaging}</wildfly27.deploy.filename>
                <wildfly27.undeploy.ignore-missing-deployment>true</wildfly27.undeploy.ignore-missing-deployment>
                <wildfly27.undeploy.match-pattern>${project.artifactId}.*</wildfly27.undeploy.match-pattern>
                <wildfly27.undeploy.match-pattern-strategy>all</wildfly27.undeploy.match-pattern-strategy>
            </properties>

            <dependencies>
                <!-- Java EE API -->
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-7.0</artifactId>
                    <version>1.0.3.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>

                <!-- Arquillian WildFly Domain Remote Container -->
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-domain-remote</artifactId>
                    <version>5.0.0.Alpha1</version>
                    <scope>test</scope>
                </dependency>

                
            </dependencies>
            
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/resources</directory>
                    </testResource>
                    <testResource>
                        <directory>src/test/resources-wildfly</directory>
                    </testResource>
                    <testResource>
                        <directory>src/test/resources-wildfly27</directory>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <groupId>org.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <version>4.2.0.Final</version>
                        <configuration>
                            <hostname>10.75.8.165</hostname>
                            <username>admin</username>
                            <password>XqZdFP6eYp</password>
                            <server-groups>
                                <server-group>${wildfly27.servergroup}</server-group>
                            </server-groups>
                            <filename>${wildfly27.deploy.filename}</filename>
                            <ignoreMissingDeployment>${wildfly27.undeploy.ignore-missing-deployment}</ignoreMissingDeployment>
                            <matchPattern>${wildfly27.undeploy.match-pattern}</matchPattern>
                            <matchPatternStrategy>${wildfly27.undeploy.match-pattern-strategy}</matchPatternStrategy>
                        </configuration>
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <forkMode>always</forkMode>
                            <systemPropertyVariables>
                                <arquillian.deploymentExportPath>target/deployments/</arquillian.deploymentExportPath>
                                <arquillian.launch>wildfly27-remote</arquillian.launch>
                                <!-- Settings for accessing remote WildFly instance -->
                                <arq.container.wildfly27-remote.configuration.managementAddress>localhost</arq.container.wildfly27-remote.configuration.managementAddress>
                                <arq.container.wildfly27-remote.configuration.managementPort>2090</arq.container.wildfly27-remote.configuration.managementPort>
                                <arq.container.wildfly27-remote.configuration.username>admin</arq.container.wildfly27-remote.configuration.username>
                                <arq.container.wildfly27-remote.configuration.password>XqZdFP6eYpfKSTRoEMXJ</arq.container.wildfly27-remote.configuration.password>
                                <!-- Maps given server group to a @DeploymentTarget named 'default' -->
                                <arq.container.wildfly27-remote.configuration.containerNameMap>batch=default</arq.container.wildfly27-remote.configuration.containerNameMap>
                            </systemPropertyVariables>
                            <redirectTestOutputToFile>false</redirectTestOutputToFile>
                        </configuration>
                    </plugin>
                    
                </plugins>
            </build>
        </profile>
    </profiles>
    
    <distributionManagement>
        <repository>
            <id>artifactory</id>
            <name>Artifactory</name>
            <url>http://artifactory.bnk.com/artifactory/libs-snapshot</url>
        </repository>
    </distributionManagement>
</project>

Earlier i have added 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">
    <servers>
        <server>
            <id>artifactory</id>
            <username>admin</username>
            <password>fFunxmi</password>
        </server>
    </servers>
</settings>

It is admin password and It did not worked for me.

[INFO] Uploading to artifactory: http://artifactory.bnk.com/artifactory/libs-snapshot/com/tiery/integrator/banking/gitlab-to-wildfly/1.0-SNAPSHOT/gitlab-to-wildfly-1.0-20230829.041226-1.pom
 [INFO] Uploading to artifactory: http://artifactory.bnk.com/artifactory/libs-snapshot/com/tiery/integrator/banking/gitlab-to-wildfly/1.0-SNAPSHOT/gitlab-to-wildfly-1.0-20230829.041226-1.war
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time:  3.361 s
 [INFO] Finished at: 2023-08-29T04:12:30Z
 [INFO] ------------------------------------------------------------------------
 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy (default-deploy) on project gitlab-to-wildfly: Failed to deploy artifacts: Could not transfer artifact com.tiery.integrator.banking:gitlab-to-wildfly:pom:1.0-20230829.041226-1 from/to artifactory (http://artifactory.bnk.com/artifactory/libs-snapshot): status code: 401, reason phrase: Unauthorized (401) -> [Help 1]

I went to artifactory and done following:

enter image description here

But i am getting same issue.

The link is accessible with admin password as well as when i changed to anonymous when i hit directly via Chrome. enter image description here

Also my gitlab.yml file has following:

publish:wf27:
  stage: publish
  only:
    - master
  script:
    - /opt/apache-maven-3.9.4/bin/mvn clean deploy -B -U -Dmaven.test.skip=true -Dprofile.wildfly27
  tags:
    - test

Can someone gives some wonderful suggestions what i am doing wrong.

0

There are 0 best solutions below