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

Deploys artifacts when `maven.deploy.skip` is `true` #39

Closed TobiX closed 2 years ago

TobiX commented 2 years ago

Describe the bug

Deploys artifacts which should not be deployed.

To Reproduce

Create a multi-module Maven project where one module contains this config:

  <properties>
    <maven.deploy.skip>true</maven.deploy.skip>
  </properties>

Expected behavior

Modules marked with maven.deploy.skip should not be deployed.

Screenshots If applicable, add screenshots to help explain your problem.

Versions

Additional context Add any other context about the problem here.

pugangxa commented 2 years ago

Encounter this too, will we fix this bug?

NewLunarFire commented 2 years ago

This property skips deployment for the maven-deploy-plugin and not for the artifactory-maven-plugin. The artifactory-maven-plugin automatically sets this property to false to avoid deploying artifacts twice.

You need to add an additional parameter in the section of your configuration that is: <publishArtifacts>false</publishArtifacts>

Also I think there is a property that does this: artifactory.publish.artifacts

yahavi commented 2 years ago

@TobiX @pugangxa @NewLunarFire, Thanks for using the Maven Artifactory plugin.

We are working on supporting the maven.deploy.skip property. Could you please elaborate on the cause? Why would you use the deploy goal with maven.deploy.skip=true? Would you expect the Maven Artifactory plugin to collect and publish the build-info when maven.deploy.skip=true?

We're looking forward to your answer!

pugangxa commented 2 years ago

In my case, I have a maven repo that has some sub modules, one module is for the code coverage report purpose so I do not want to publish anything on it, so I want to set maven.deploy.skip property in the sub-module level to skip it.

yahavi commented 2 years ago

Thanks, @pugangxa. We created https://github.com/jfrog/artifactory-maven-plugin/pull/43 to fix this issue by skipping the deployment of the module's artifacts when there is a property in the module <maven.deploy.skip>true</maven.deploy.skip>. Please let me know if you disagree with the change.

TobiX commented 2 years ago

My use case is similar to @pugangxa - There are some internal modules which don't publish any artifacts and the "conventional" way before adding this plugin to our standard Maven builds was to set that property (or configure the maven-deploy-plugin directly, but that's much less common, so I don't care if that use case is supported). This has a bit to do with expectations: I wasn't expecting the Artifactory plugin to alter how my Maven workflow works in a basic way (I would have expected a plugin which modifies how the deployment of my projects work to implement something like a Maven Wagon plugin, not disabling the Maven Deploy plugin "from the outside"). Now that I understand how the plugin works I would expect it to at least mimic the maven-deploy-plugin behaviour as far as this property goes...

yahavi commented 2 years ago

@TobiX @pugangxa @NewLunarFire, Maven Artifactory plugin 3.5.0 is released. This version includes the fix for this issue. Feel free to upgrade - we'd appreciate your feedback on that.