[ 
https://issues.apache.org/jira/browse/MDEPLOY-312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774983#comment-17774983
 ] 

Jared Stehler commented on MDEPLOY-312:
---------------------------------------

Thanks for the pointers! I'd imagine that to use the listener approach, I'd 
need to call `RepositorySystemSession.setRepositoryListener()` in a mojo or 
extension prior to the deploy mojo execution, and that callback would happen 
within the context of the deploy mojo execution?

Unfortunately our resolver isn't open source, but operates like this:

 
The first part is the API. Every time a snapshot artifact is built, it reports 
to the API with the groupId, artifactId, base version, and the new resolved 
snapshot version. We keep track of the latest snapshot version for each 
group/artifact/version combo in a db table.

The client portion is implemented as a Maven extension (installed by dropping a 
JAR in $M2_HOME/lib). When you run Maven, this extension gets loaded and hits 
the API. It asks the API for any new snapshot versions since the last time it 
ran. For each new snapshot, it writes the new snapshot timestamp to a file 
inside the .m2 repo.

The extension also implements a custom update policy. Maven asks the update 
policy whether it needs to hit Nexus to check for a new snapshot version. To 
answer this question, the extension reads the aforementioned file containing 
the latest snapshot timestamp. It then loads the current maven-metadata.xml 
from disk and parses out the snapshot timestamp from there. If the timestamp is 
newer than the snapshot timestamp from the maven-metadata.xml, then there is a 
new snapshot version and it needs to hit Nexus to fetch it. Otherwise, we 
already have the latest snapshot and don't need to fetch anything.

> [REGRESSION] deploy no longer updates project model
> ---------------------------------------------------
>
>                 Key: MDEPLOY-312
>                 URL: https://issues.apache.org/jira/browse/MDEPLOY-312
>             Project: Maven Deploy Plugin
>          Issue Type: Bug
>          Components: deploy:deploy, deploy:deploy-file
>    Affects Versions: 3.0.0
>            Reporter: Jared Stehler
>            Priority: Major
>
> Prior to 3.0.0, the maven-deploy-plugin would update artifacts on the Project 
> model:
>  * 
> [https://github.com/apache/maven/blob/master/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java#L147]
>  * 
> [https://github.com/apache/maven-deploy-plugin/blob/maven-deploy-plugin-2.8.2/src/main/java/org/apache/maven/plugin/deploy/DeployFileMojo.java#L276]
> This is no longer occurring with the migration to maven-resolver, which is 
> breaking our downstream plugins relying on the resolved SNAPSHOT version.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to