0

Maven 3.0.0 deploy files at a server with timestamp attached to it. I need to wget the latest version artifact from the server without refering the maven-metadata.xml. Is there any way to create the symlink using maven deploy.

Command used to deploy file to server-

mvn -B deploy:deploy-file -DpomFile=pom.xml -Dpackaging=zip -Dfile=my_file.zip -Durl="https://some_server" -DrepositoryId="some_id"

e.g. I uploaded a zip at loc https://some_server/

Now my uploaded zip name became my_file_20211102.062936-9.zip

I want a common name e.x my_file_latest.zip to refer to the latest uploaded zip, so that I can use

wget https://some_server/my_file_latest.zip

to download the latest version.

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
user7665394
  • 39
  • 1
  • 5
  • First is the version 3.0.0 really the Maven version you are using? If so please Upgrade to most recent one. Why do you use deploy-file instead of `mvn deploy` ? Is the server a repository manager ? If not start to use one... – khmarbaise Nov 02 '21 at 08:07
  • The whole approach raises so many questions ... maybe you add a little background about what you are doing because the approach sounds wrong. – J Fabian Meier Nov 02 '21 at 08:24
  • Based on my understanding, you are uploading a file from (Server A) to (Server B) using mvn (some protocol). Maven will not have access to your remote server. That is not how it works. However (You could use exec-maven-plugin) and run a local script.sh file (In Server A) that (SSHs into remove server, rename my_file_xxxxxx.zip to my_file_latest) – JCompetence Nov 02 '21 at 08:55
  • https://stackoverflow.com/questions/12412519/run-remote-command-via-ssh-using-maven3 – JCompetence Nov 02 '21 at 08:55

1 Answers1

0

Resolved the issue using mvn:get dependency. It will always download latest version.

user7665394
  • 39
  • 1
  • 5