简体   繁体   中英

How to make maven to read jar from Nexus which is in P2 format

I have a maven project, currently it is reading the required plugins from central. To avoid that, we could like to read the binaries from Nexus which is currently present in P2 format.

For that I have tried with using p2-maven-plugin and jetty-maven-plugin, as like below:

    <plugin>
    <groupId>org.reficio</groupId>
    <artifactId>p2-maven-plugin</artifactId>
    <version>1.3.0</version>
    <executions>
        <execution>
            <id>default-cli</id>
            <configuration>
                <artifacts>
                    <!-- specify your depencies here -->
                    <!-- groupId:artifactId:version -->                    
                    <artifact><id>commons-io:commons-io:2.1</id></artifact>
                    <artifact><id>commons-lang:commons-lang:2.4</id></artifact>
                    <artifact><id>commons-lang:commons-lang:2.5</id></artifact>
                    <artifact><id>commons-lang:commons-lang:2.6</id></artifact>
                    <artifact><id>org.apache.commons:commons-lang3:3.1</id></artifact>
                </artifacts>
            </configuration>
        </execution>
    </executions>
</plugin>
            
    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.5.v20120716</version>
        <configuration>
            <scanIntervalSeconds>10</scanIntervalSeconds>
            <webAppSourceDirectory>${project.basedir}/target/repository/</webAppSourceDirectory>
            <webApp>
                <contextPath>/site</contextPath>
            </webApp>
        </configuration>
    </plugin>

After using that as well my project is not reading the P2 dependencies from Nexus. I have mentioned the repository details in my settings.xml. Can someone provide inputs on how to read the P2 repo from Nexus for a maven project ? Thanks !

The correct way is to configure Maven to use your Nexus instance on your local network as a mirror (in settings.xml) at a URL that contains the packages you need.

Nexus provide a maven central mirror URL out of the box.

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