{"id":1498,"date":"2021-10-12T10:22:43","date_gmt":"2021-10-11T21:22:43","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1498"},"modified":"2021-12-07T19:11:40","modified_gmt":"2021-12-07T06:11:40","slug":"removing-the-timestamp-from-the-downloaded-snapshot","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1498","title":{"rendered":"Removing the Timestamp from the downloaded SNAPSHOT"},"content":{"rendered":"<h2>Use case<\/h2>\n<p>The downloaded snapshot has timestamp associated with it like the following:<\/p>\n<p><strong>artifact-1.0.0-20211012.041152-1.jar<\/strong><\/p>\n<p>But the tooling is expecting an absolute name like the the following:<\/p>\n<p><strong>artifact-1.0.0-SNAPSHOT.jar<\/strong><\/p>\n<h2>Powershell Script<\/h2>\n<pre><code class=\"language-powershell\">#The target artifact\n$ArtifactId = &quot;artifact&quot;\n\n#The target SNAPSHOT version\n$Version = &quot;1.0.0-SNAPSHOT&quot;\n\nif ($Version -match &quot;^(.*)-SNAPSHOT$&quot;) \n{\n    $Prefix = &quot;{0}-{1}&quot; -f $ArtifactId,$Matches.1\n    $Pattern = &quot;^(${Prefix}).*(\\.jar)$&quot;\n\n    Get-ChildItem (&#039;.&#039;) | ForEach-Object {\n        If ($_.Name -match $Pattern) {\n            $NewName = &quot;{0}-SNAPSHOT{1}&quot; -f $Matches.1, $Matches.2\n            Rename-Item $_ -NewName $NewName\n            $Message = &quot;Renaming from {0} to {1}&quot; -f $_.Name, $NewName\n            echo $Message\n        }\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use case The downloaded snapshot has timestamp associated with it like the following: artifact-1.0.0-20211012.041152-1.jar But the tooling is expecting an absolute name like the the following: artifact-1.0.0-SNAPSHOT.jar Powershell Script #The target artifact $ArtifactId = &quot;artifact&quot; #The target SNAPSHOT version $Version = &quot;1.0.0-SNAPSHOT&quot; if ($Version -match &quot;^(.*)-SNAPSHOT$&quot;) { $Prefix = &quot;{0}-{1}&quot; -f $ArtifactId,$Matches.1 $Pattern = &quot;^(${Prefix}).*(\\.jar)$&quot; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,30],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1498"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1498"}],"version-history":[{"count":1,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1498\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1498\/revisions\/1500"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}