Create an Eclipse project on the command line?

后端 未结 4 1610
难免孤独
难免孤独 2020-12-05 14:53

I would like to have a shell script create an entire CDT project on the command line and add it to a workspace. I\'m willing to generate the .project and .cproject files mys

相关标签:
4条回答
  • 2020-12-05 15:15

    I believe all you need is to do is create a folder here:

    WORKSPACE_DIR\.metadata\.plugins\org.eclipse.core.resources\.projects\YOUR_PROJECT_NAME
    

    and a .location file in it.

    You can either use the Eclipse Resources API, or try to implement it yourself based on the current implementation

    I don't know if there's an easiest way

    0 讨论(0)
  • 2020-12-05 15:18

    This page contains also some convenience script: http://lugendal.wordpress.com/2009/07/22/eclipse-ctd-new-project-fast/

    0 讨论(0)
  • 2020-12-05 15:27

    There is a ant+groovy script in a different post, see https://stackoverflow.com/a/16949573/2457383

    Disclaimer: The other post is also mine :)

    0 讨论(0)
  • 2020-12-05 15:30

    What version of CDT are you using?

    If you have the recent CDT 6+ installed, you can perform a project import (as well as build), from the command line. To do this:

    eclipse -nosplash 
        -application org.eclipse.cdt.managedbuilder.core.headlessbuild 
        -import {[uri:/]/path/to/project} 
        -build {project_name | all} 
        -cleanBuild {projec_name | all}
    

    The import switch can be used by itself. You'll need to specify the workspace you wish to import into with -data as normal to Eclipse. The switches illustrated above are provided by the CDT managedbuild plugin, but should work with non-CDT projects (if not, let me know -- I wrote the feature ;) ).

    See this question on headless build for more details on the other switches.

    0 讨论(0)
提交回复
热议问题