artifactory-maven-plugin icon indicating copy to clipboard operation
artifactory-maven-plugin copied to clipboard

Artifactory maven plugin adding -mule-plugin as a suffix to the pom.xml while deploying to Artifactory

Open logeshjf opened this issue 1 year ago • 0 comments

Describe the bug

When using the Aritfactory Maven plugin with the Mule plugin, the pom.xml files deployed to the Artifactory local repository have -mule-plugin as a suffix. The mule plugin adds the suffix to the jar files as were are adding it in the mule-plugin however, Artifactory plugin adds the suffix to the pom files on the upload.

Eg: - dummy-project-1.0.0-20241113.201822-3-mule-plugin.pom

Tested the same by deploying directly to the local directory after removing the Artifactory maven plugin and the pom files don't have the suffix

drwxr-xr-x 3 root root 4096 Nov 13 20:47 ..
-rw-r--r-- 1 root root 2535 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1-mule-plugin.jar
-rw-r--r-- 1 root root   32 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1-mule-plugin.jar.md5
-rw-r--r-- 1 root root   40 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1-mule-plugin.jar.sha1
-rw-r--r-- 1 root root 1950 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1.pom
-rw-r--r-- 1 root root   32 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1.pom.md5
-rw-r--r-- 1 root root   40 Nov 13 20:47 dummy-project-1.0.0-20241113.204730-1.pom.sha1
-rw-r--r-- 1 root root  819 Nov 13 20:47 maven-metadata.xml
-rw-r--r-- 1 root root   32 Nov 13 20:47 maven-metadata.xml.md5
-rw-r--r-- 1 root root   40 Nov 13 20:47 maven-metadata.xml.sha1

Current behavior

The client/builds unable to resolve artifacts which were built and deployed using the mule plugin and the Artifactory maven plugin.

What is the impact: The Maven client/Jenkin builds will fail since they are unable to fetch the correct pom.xml file from Artifactory since they were pushed wrongly by the plugin.

Reproduction steps

  1. Create a sample maven project with both the mule plugin and the Artifactory maven plugin.
  2. Here is a sample Pom.xml file.
<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>org.example</groupId>
    <artifactId>dummy-project</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>4.3.0</version>
                <extensions>true</extensions>
                <configuration>
                    <classifier>mule-plugin</classifier>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jfrog.buildinfo</groupId>
                <artifactId>artifactory-maven-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <id>build-info</id>
                        <goals>
                            <goal>publish</goal>
                        </goals>
                        <configuration>
                            <deployProperties>
                                <gradle>awesome</gradle>
                            </deployProperties>
                            <artifactory>
                                <includeEnvVars>true</includeEnvVars>
                                <envVarsExcludePatterns>*password*,*secret*,*key*,*token*,*passphrase*</envVarsExcludePatterns>
                                <timeoutSec>60</timeoutSec>
                            </artifactory>
                            <publisher>
                                <contextUrl>https://arturl/artifactory</contextUrl>
                                <username>user</username>
                                <password>password</password>
                                <excludePatterns>*-tests.jar</excludePatterns>
                                <repoKey>test-libs-release</repoKey>
                                <snapshotRepoKey>test-libs-snapshot</snapshotRepoKey>

                                <publishArtifacts>false</publishArtifacts>
                                <publishBuildInfo>false</publishBuildInfo>
                                <excludePatterns>..</excludePatterns>
                                <includePatterns>..</includePatterns>
                                <filterExcludedArtifactsFromBuild>true</filterExcludedArtifactsFromBuild>
                                <recordAllDependencies>false</recordAllDependencies>
                                <minChecksumDeploySizeKb>10</minChecksumDeploySizeKb>
                            </publisher>
                            <buildInfo>
                                <buildName>plugin-demo</buildName>
                                <buildNumber>${buildnumber}</buildNumber>
                                <buildUrl>http://build-url.org</buildUrl>
                            </buildInfo>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <!-- Shared Mule Services Repository -->
        <repository>
            <id>ac-artifactory-snapshots</id>
            <name>test-snapshots</name>
            <url>https://arturl/artifactory/test-libs-snapshot</url>
            <layout>default</layout>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>ac-artifactory-snapshots</id>
            <name>test-snapshots</name>
            <url>https://arturl/artifactory/test-libs-snapshot</url>
            <layout>default</layout>
        </repository>
    </distributionManagement>
</project>

  1. Perform the maven deploy using below command.

mvn clean deploy -Dbuildnumber=1 -s settings.xml -U

Expected behavior

Artifactory maven plugin shouldn’t add the additional suffix ‘-mule-plugin’ while deploying artifacts to the Artifactory so that the clients can resolve it.

Eg: - dummy-project-1.0.0-20241113.201822-3.pom

Artifactory Maven plugin version

3.6.1

Operating system type and version

Debian GNU/Linux 12 (bookworm)

JFrog Artifactory version

SaaS (7.100.2)

Maven version

3.9.9

logeshjf avatar Nov 26 '24 17:11 logeshjf