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

[Feature Request] Follow maven convention over configuration paradigm #32

Open EstebanDugueperoux2 opened 2 years ago

EstebanDugueperoux2 commented 2 years ago

Hello,

If I understand correctly this maven plugin make job of jfrog cli in a maven context to upload buildinfo as described in "Running maven" section of https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-BuildIntegration.

In my Gitlab CI context I have following pom.xml config:

                <plugin>
                    <groupId>org.jfrog.buildinfo</groupId>
                    <artifactId>artifactory-maven-plugin</artifactId>
                    <version>3.4.0</version>
                    <inherited>false</inherited>
                    <executions>
                        <execution>
                            <id>build-info</id>
                            <goals>
                                <goal>publish</goal>
                            </goals>
                            <configuration>
                                <publisher>
                                    <contextUrl>https://artifactory.corporate.com/artifactory/</contextUrl>
                                    <repoKey>myMavenRemoteRepo</repoKey>
                                    <username>${env.MAVEN_REPO_USER}</username>
                                    <password>${env.MAVEN_REPO_PASS}</password>
                                </publisher>
                                <!-- Maps Gitlab env var (https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) to JFrog buildinfo -->
                                <buildInfo>
                                    <buildUrl>${env.CI_JOB_URL}</buildUrl>
                                </buildInfo>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

And after invoking "mvn deploy" I get the buildUrl metadata in our Artifactory instance to have a link to the upload artifact related CI job. But what should be better is to follow "convention over configuration" maven principle, especially about publisher part for which info already exist in distributionManagement tag and in settings.xml to allow maven deploy plugin to upload artifact.

Regards.