简体   繁体   中英

Is there a way for a maven plugin to request maven-metadata.xml from a remote repository?

Consider I'm a Maven plugin and I'd like to read Maven Repository Metadata ( maven-metadata.xml ) for certain group or artifact from a remote repository (Nexus in this case).

Is there a built-in Maven functionality available to a plugin to retrieve this piece of information?

My use case is the following: I've got a list of artifacts in a proprietary file format. Each of these artifacts might have an according configuration artifact stored in Nexus but not listed in the file. Also, not all artifacts have a version applied. Now I'd like to create a standard BOM and I'd like to leverage information available in maven-metadata.xml .

You can use below code.I am doing this in my project and its working for me:

 <repositories>
        <repository>
            <id>YOUR_ID</id>
            <url>NEXUS_URL</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM