1

I have written a plugin that uses PDT (and thus DLTK) to create a customized project. I now to need to add libraries to the buildpath of my custom project.

I do have a plugin that contains these libraries and I've been struggling trying to figure out how to create / modify the .buildpath file. I was not successful trying to use BuildpathEntry, as it seemed to fail because the path I provided to .buildpath did not contain a device id.

I'm not sure where to go from here.

EDIT: I'm trying to add PHP libraries to the .buildpath file of my PDT project in my custom plugin, just to be clear ;)

Alex Dow
  • 588
  • 1
  • 4
  • 16
  • Have you tried expressing a dependency from your PDT plug-in to the plug-in that contains those libraries? Ie in plugin.xml – katsharp Feb 24 '12 at 16:02
  • The libraries are PHP libraries (eg: Zend Framework), not java ones, so I can't create a dependency there. – Alex Dow Feb 24 '12 at 16:24

1 Answers1

2

You could do this with the addEntriesToBuildPath method of org.eclipse.php.internal.core.buildpath.BuildPathUtils.

  1. Add org.eclipse.php.core and org.eclipse.dltk.core to the dependencies of your plugin.xml. (you have need installed PDT SDK)

  2. Add the build path entry when create the project:

    IScriptProject scriptProject = DLTKCore.create(project);
    List<IBuildpathEntry> bentries = new ArrayList<IBuildpathEntry>();
    IBuildpathEntry juliaServerEntry = DLTKCore.newProjectEntry(new Path("/otherproject"));
    bentries.add(juliaServerEntry);
    BuildPathUtils.addEntriesToBuildPath(scriptProject, bentries);
    
s.csaba75
  • 21
  • 2