jfrog / artifactory-maven-plugin

A Maven plugin to resolve artifacts from Artifactory, deploy artifacts to Artifactory, capture and publish build info.
https://www.jfrog.com/confluence/display/JFROG/Maven+Artifactory+Plugin
Apache License 2.0
24 stars 26 forks source link

maven dependencies not publishing to buildInfo #87

Open javamllama opened 9 months ago

javamllama commented 9 months ago

Describe the bug

When I have a pom.xml that has dependencies declared (see example below) and I run the mvn artifactory:publish -Dpublish.record.all.dependencies=true (with the other required flags enabled too) it is not adding the dependencies to the buildInfo record in artifactory.

Note: I tested this with 3.6.0, 3.6.1, and 3.6.2 of the build-info plugin and none of them seem to work.

See source code link for config option here: https://github.com/jfrog/build-info/blob/master/build-info-extractor/src/main/java/org/jfrog/build/extractor/clientConfiguration/ClientConfigurationFields.java#L38C39-L38C62

example pom:

<?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.myapp</groupId>
    <artifactId>mymavenapp</artifactId>
    <packaging>jar</packaging>
    <version>1.0</version>
    <name>mymavenapp</name>
    <url>https://github.com/myapp/mymavenapp</url>

    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.11</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                        <!-- <release>10</release> -->
                        <source>1.8</source>
                        <target>1.8</target>
                        <!-- <executable>/usr/lib/jvm/java-11-openjdk-amd64/bin/javac</executable> -->
                        <!-- <enablePreview>true</enablePreview> -->
                </configuration>
            </plugin>
            <!-- This is just to make sure the class is set as main class to execute from the jar-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>edu.forty.bits.expression.SwitchExpressions</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Current behavior

publishes buildInfo but no dependencies included.

Reproduction steps

No response

Expected behavior

publishes dependencies with artifact modules in buildInfo similar to 2.x plugin behavior

Artifactory Maven plugin version

3.6.x

Operating system type and version

windows and RHE

JFrog Artifactory version

7.63.14

Maven version

3.9.6