代码之家  ›  专栏  ›  技术社区  ›  Xian

构建的常用文件夹结构

  •  25
  • Xian  · 技术社区  · 17 年前

    我想知道在项目中组织构建资产和源代码的流行或最佳方式是什么?

    9 回复  |  直到 17 年前
        1
  •  19
  •   JeeBee    17 年前

    我有

    /src    - source files (test files are within a package 'test' here, or 'test' subpackage of what is being tested)
    /lib    - required libraries
    /doc    - text documentation and development notes
    /build  - where we build (each separate build item within a subfolder here)
    /conf   - configurations (each config, production, test, developer, etc gets a folder in here, and when building Jars and Wars the correct set is copied across)
    /extras - other stuff
    /extras/resources - resources that should be included within generated Jars, e.g., icons
    

    具有

    /websites - Web related content and configurations (each website in its own folder here)
    /websites/$site/webcontent - All the web content here
    /websites/$site/conf - website related configuration files here (instead of /conf)
    /websites/$site/build.xml - ANT build script for website that creates a war, etc
    
    (remember you might have an admin site and a public site for a single project, hence the multi-site configuration within a single project, or even site v1 and site v2, etc)
    

    最后,根据项目本身以及使用ANT还是Maven,你必须有点灵活。我使用ANT,并将ANT脚本放在/build中,但它们已经出现在某些项目的其他地方(比如在/websites/中)。

        2
  •  12
  •   Martin Wickman    17 年前

    一般来说:

    src/      - source files
    src/tests - unit tests
    doc/      - documentation
    res/      - static resources (textures, locale database, level definitions etc)
    build/    - tools needed to build the system
                project specific libraries and compilers
    Makefile  - the makefile (make, test, clean etc)
    
        3
  •  5
  •   Romain Linsolas    17 年前

    由于我只处理Java项目,而且所有项目都是“Mavenized”的,所以我使用 conventions defined by Maven for the project structure .

    基本上:

    project
      src/main/java        --> source files
      src/main/resources   --> resources files (*.xml, *.properties, etc.)
      src/test/java        --> source files for tests.
      src/test/resources   --> resources files for tests.
    
        4
  •  5
  •   Xian    17 年前

    例如,我使用以下内容。网络风格项目;

    /build/reports  - reports and logs from the build process
    /build/artifacts  - all output of the build process is copied here
    /src/  - all solution source code
    /lib/  - 3rd party or other build dependencies
    /tools/...  - all other helper tools used in the build process
    /tools/nant  - example tool
    /tools/nunit  - example tool
    /myProject.sln  - visual studio solution file (or other IDE)
    /default.build  - nant build file
    
        5
  •  3
  •   Rinat Abdullin    17 年前

    此文件夹组织代表了 xLim concepts .

    你可以在 this open source project .

    Build           - ignored from version control
      Artifact      - build artifacts (grabbed by CC.NET from here)
      Package       - generated zip or install packages
      Test          - all assemblies for unit tests
      Help          - autogenerated documentation
    Resource
      Build         - plugins and extensions for NAnt/MSBuild
      Library       - 3rd party dependencies
      Tool
        FxCop
        ILMerge          
        NCover
        NCoverExplorer
        NUnit
        SHFB
        Wix
    Samples
      SampleProject1
      SampleProject2  
    Source
      Project1
      Project2
    
      GlobalAssemblyInfo.cs
      VersionAssemblyInfo.cs   - integration server updates this one
    
    Test
      Project1.Tests
      Project2.Tests        
    
    Solution.build        - primary build file
    Solution.ccnet        - CruiseControl adapter for the build file
    Solution.sln          - Visual Studio
    
    go.cmd                - shortcut for launching the build file locally
    readme.txt            - licenses and overview
    SharedKey.snk         - for strong naming
    
        6
  •  2
  •   Community Mohan Dere    6 年前

    我个人使用

    /client/projectname/trunk/source/Solution Name.sln
    /client/projectname/trunk/source/Project.One
    /client/projectname/trunk/source/Project.Two
    /client/projectname/trunk/source/Project.Three
    /client/projectname/trunk/source/SQL/
    /client/projectname/trunk/source/SQL/SomeScript.sql
    /client/projectname/trunk/libraries
    /client/projectname/trunk/resources/Nunit
    /client/projectname/trunk/resources/LLBLGEN
    /client/projectname/trunk/documentation
    /client/projectname/trunk/builds
    

    这对我们来说很好,但我认为这不是最好的。 如果是关于.net的 你也可以看看 treesurgeon 他们自己将其描述为:

    你曾经花过几天时间建立一个新的开发树吗?你是否花了几天时间建立了几棵开发树?你是否花了数周时间试图使用一组最佳实践来完善你所有的开发树?

    如果上述任何一个答案都是“是”,那么你会喜欢《树木外科医生》!

    树木外科医生是一名。NET开发树生成器。只需给它你的项目名称,它就会在几秒钟内为你建立一个开发树。更重要的是,你的新树已经积累了多年的建造工程经验。

        7
  •  0
  •   user22940    17 年前

    为了。NET项目检查 ProjectScaffold 以及在此下的讨论 gist .

        8
  •  0
  •   jdmartin86    12 年前

    我喜欢这种方式 Netbeans IDE组织项目。只需启动一个新项目,它就会设置一个默认的开发树和一个ant脚本。

        9
  •  0
  •   Rafał Kłys    11 年前

    对我来说,这取决于项目的规模。对于小型项目,我发现一个包含单个Makefile、/src和/include目录的项目目录效果很好。

    推荐文章