Closed jeremywall closed 2 years ago
Please run your build with a -X option. Do you see any log lines starting with 'Fetching '? Does that path have an extra '/'?
How is your repository
I decided to setup a clean demo project to reproduce this. I've posted the project for a dummy demo library at https://github.com/jeremywall/maven-artifact-repo-aws-s3-demo.
I reduced my Maven settings.xml file to the bare minimum and it's shown in the README file at the GitHub repo above.
When using 0.6.0 in the project's pom.xml I can mvn deploy
and it will correctly find the existing files in the S3 bucket and stop the build.
When using 0.7.0 in the project's pom.xml and I run mvn deploy
it still fails to locate the existing files in the S3 bucket and lets the build continue and at the end the files in S3 are overwritten.
Logs for your Maven plugin when I run mvn deploy -X
with both 0.6.0 and 0.7.0 are in the logs folder of the GitHub repo.
From the 0.7.0 log on line 504 you can see the URL path is incorrect with the mystery extra forward slash getting URL encoded as %2F like so:
[DEBUG] Executing request HEAD /release/%2Fdev/jeremywall/mavens3demo/demo-library/1/demo-library-1.jar HTTP/1.1
Please try using 0.8.0-SNAPSHOT
No luck I'm afraid, I compiled and installed 0.8.0-SNAPSHOT and when I ran my sample project with that it still has the %2F and can't find the existing jar in the S3 bucket. I've posted the log at https://github.com/jeremywall/maven-artifact-repo-aws-s3-demo/blob/main/logs/exists-maven-plugin-0.8.0-SNAPSHOT.log
@jeremywall, please try with today's updates.
SUCCESS!!!
It now detects the existence of the file in S3 and fails with the message "Artifact already exists in repository: dev.jeremywall.mavens3demo:demo-library:jar:1"
The log for this test run is at https://github.com/jeremywall/maven-artifact-repo-aws-s3-demo/blob/main/logs/exists-maven-plugin-0.8.0-SNAPSHOT-round2.log
Thank you for the fast turn around and work on resolving this.
Pushed 0.8.0 to central
I use maven to package and deploy some common code library jars to an Amazon S3 bucket which serves as a private artifact repository. The deployment to the S3 bucket is done via the
org.springframework.build:aws-maven:5.0.0.RELEASE
maven extension. Theexists-maven-plugin
has been fantastic at preventing new builds from overwriting existing deployments but something changed in 0.7.0. It no longer detects the existing deployments and overwrites them every time. When I test against a public artifact repository like Maven Central I see that 0.7.0 always works and detects the existing deployments.I've run maven with the debug flag and noticed a difference between the HTTP requests that are generated between version 0.6.0 and 0.7.0.
In version 0.7.0 the following HTTP call is logged. I've anonymized and redacted some values but the issue is still clear. In the request generated by version 0.7.0 there is a "%2F" in the URL path (the URL encoded value for a forward slash) that does not appear when I use version 0.6.0.
Under 0.6.0 the URL path that is generated and checked is
/release/com/example/commons/215/commons-215.jar
which returns an HTTP 200 response and themaven-exists-plugin
correctly stops the build and reports that the version is already deployed.I've done a very basic look through of your code and I don't see anything that changed in 0.7.0 that looks like an immediate culprit for this issue. Could it be the change to Maven 3.8.4 in your plugin's pom.xml?