I always use these two commands to generate a p2 repository:
java -jar %ECLIPSE_HOME%\plugins\org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/C:/repository -artifactRepository file:/C:/destination -source /C:/source -configs gtk.linux.x86 -compress -publishArtifacts
where c:/source
are stored my bundles, and then
%ECLIPSE_HOME%/eclipse -debug -consolelog -nosplash -verbose -application org.eclipse.equinox.p2.publisher.CategoryPublisher -metadataRepository file:C:/destination -categoryDefinition file:C:/source/category.xml
the C:/source
tree is like this
source
-- feaures
-- plugins
-- category.xml
and you'll need this category.xml
file to group your bundles into categories. This is the category's content
<?xml version="1.0" encoding="UTF-8"?>
<site>
<category-def name="all" label="P2 Repo"/>
<iu>
<category name="all"/>
<query><expression type="match">providedCapabilities.exists(p | p.namespace == 'osgi.bundle')</expression></query>
</iu>
</site>
depending on your eclipse version, maybe you'll need to change the version of this file org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar