獲取POM.XML依賴的JAR包


pom.xml 文件的依賴在本地倉庫中,有些情況我需要根據pom.xml 抓取所有依賴的JAR包。

這個可以通過 ant 完成這個包的抓取。

<target name="maven-jar" description="management jar files use maven2">
        <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
            <classpath>
                <pathelement location="refLib/maven-ant-tasks-2.1.3.jar" />
            </classpath>
        </typedef>

        <artifact:pom id="pom" file="pom.xml" />
            <artifact:dependencies settingsfile="D:/mvn/settings.xml" pathId="maven.classpath" filesetId="maven.fileset" pomRefId="pom" useScope="runtime">
        </artifact:dependencies>

        <copy todir="${refLib}/">
            <fileset refid="maven.fileset" />
                <mapper type="flatten" />
        </copy>
    </target>

首先需要下載 maven-ant-tasks-2.1.3.jar  jar包,這樣我們執行這個ant 腳本就可以將所有的依賴包抓取到我們指定的 目錄中了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM