我想知道在项目中组织构建资产和源代码的流行或最佳方法是什么?
我有
/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中,但它们已经出现在某些项目的其他地方(例如/ sites /中的某些项目).
一般来说:
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)
由于我只处理Java项目,并且所有这些项目都是"Mavenized",因此我使用Maven定义的约定来实现项目结构.
基本上:
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.