How to change the P2 repository configuration from the REST API

The steps below are for changing the P2 repository configuration through REST-API.


We have created a user’s plugin that you can execute with a curl command. This plugin will enable you to get and set the P2 Urls that are used by Eclipse.


1. In order to deploy this plugin, you’ll need to copy this plugin into $ARTIFACTORY_HOME/etc/plugin.

2. Then load the plugin by using Reload Plugin API


This plugin supports two commands:

  1. getP2Urls – returns the current P2 settings in your artifactory. Use the cURL command to execute this is: 

    curl -uadmin:password -X POST “http://localhost:8081/artifactory/api/plugins/execute/getP2Urls?params=repo=repoKey” Set the value of repoKey to the name of your P2 virtual repository.

  2. modifyP2Urls – Will modify the P2 according to the version set up in the json file. 
    An example to a json file could be:
    {“repo”: “p2-virtual”,”urls”: [“http://dl.google.com/eclipse/plugin/3.7″,”http://download.eclipse.org/releases/luna”,”http://download.eclipse.org/mylyn/releases/luna”,”http://download.eclipse.org/eclipse/updates/4.4″,”local://p2-local/eclipse-repository/eclipse-repository/1.0.0-SNAPSHOT/eclipse-repository-1.0.0-20141213.002711-2.zip!/”]}

    The curl command would be:

    curl -uadmin:password -T /path/to/jsonFile -X POST “http://localhost:8081/artifactory/api/plugins/execute/modifyP2Urls

Please note, we still plan to improve this with a more permanent solution. Also, please watch and vote for these tickets so you will receive updates on future development.

https://www.jfrog.com/jira/browse/RTFACT-6960

https://www.jfrog.com/jira/browse/RTFACT-6959