Last active
March 28, 2023 14:42
-
-
Save SelvinPL/f082f4507b39fdf132fda00ae9bd9ff8 to your computer and use it in GitHub Desktop.
Download maven and unpack and print all txt files in downloaded artifacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="DisplayMessages"> | |
<ItemGroup> | |
<MavenArtifact Include="commons-compress-1.23.0" Group="org.apache.commons" Artifact="commons-compress" Version="1.23.0" /> | |
<MavenArtifact Include="commons-compress-1.22" Group="org.apache.commons" Artifact="commons-compress" Version="1.22" /> | |
</ItemGroup> | |
<Target Name="DownloadArtifacts" BeforeTargets="UnzipArchive"> | |
<DownloadFile | |
SourceUrl="https://repo1.maven.org/maven2/$([MSBuild]::ValueOrDefault('%(MavenArtifact.Group)', '').Replace('.', '/'))/$([MSBuild]::ValueOrDefault('%(MavenArtifact.Artifact)', '').Replace('.', '/'))/%(MavenArtifact.Version)/%(MavenArtifact.Artifact)-%(MavenArtifact.Version).jar" | |
DestinationFolder="artifacts"> | |
<Output TaskParameter="DownloadedFile" ItemName="DownloadedArtifact"/> | |
</DownloadFile> | |
</Target> | |
<Target Name="UnzipArchive" BeforeTargets="DisplayMessages"> | |
<Unzip | |
SourceFiles="%(DownloadedArtifact.Identity)" | |
DestinationFolder="%(RelativeDir)\%(Filename)" | |
OverwriteReadOnlyFiles="true" | |
/> | |
</Target> | |
<Target Name="DisplayMessages" BeforeTargets="CoreCompile"> | |
<ItemGroup> | |
<TextFilesInArtifacts Include="artifacts/**/*.txt" /> | |
</ItemGroup> | |
<Message Importance="high" Text="All txt files in artifacts: "/> | |
<Message Importance="high" Text="%09%(TextFilesInArtifacts.Identity)"/> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
expected output (PL)
or (PL already downloaded)