Programmatically generate an Eclipse project

前端 未结 3 1943
半阙折子戏
半阙折子戏 2020-12-08 22:04

I use eclipse to work on an application which was originally created independently of eclipse. As such, the application\'s directory structure is decidedly not eclipse-frie

相关标签:
3条回答
  • 2020-12-08 22:22

    You should be able to accomplish this by writing a small Eclipse plugin. You could even extend it out to being a "headless" RCP app, and pass in the command line arguments you need.

    The barebones code to create a project is:

    IProgressMonitor progressMonitor = new NullProgressMonitor();
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = root.getProject("DesiredProjectName");
    project.create(progressMonitor);
    project.open(progressMonitor);
    

    Just take a look at the eclipse code for the Import Project wizard to give you a better idea of where to go with it.

    0 讨论(0)
  • 2020-12-08 22:24

    Use AntEclipse

    It can create eclipse projects from ant.

    0 讨论(0)
  • 2020-12-08 22:40

    To create java project you can use JavaCore from org.eclipse.jdt.core.JavaCore. As a sourceProject you can use generic project item, which has been suggested by @James Van Huis

    IJavaProject javaSourceProject = JavaCore.create(sourceProject);
    
    0 讨论(0)
提交回复
热议问题