عمليات البناء المركبة وتركيب البناء
اجمع عمليات بناء Gradle المستقلة في عملية واحدة باستخدام عمليات البناء المركبة (includeBuild)، ما يتيح لك تطوير المشاريع المترابطة واختبارها معًا دون نشر المصنوعات البرمجية.
عمليات البناء المركبة وتركيب البناء درس مجاني في Groovy & Gradle: JVM Automation and Build Engineering على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Groovy & Gradle: JVM Automation and Build Engineering، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Groovy & Gradle: JVM Automation and Build Engineering 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What is a Composite Build?
A composite build stitches multiple otherwise-independent Gradle builds together. Unlike subprojects, each included build keeps its own settings.gradle and lifecycle.
- Subprojects: one build, many modules
- Composite: many builds, joined on demand
Why Use Composites?
Composite builds shine when you work across repository boundaries:
- Develop a library and its consumer side by side
- Avoid publishing SNAPSHOTs just to test a change
- Debug a plugin in the context of a real project
includeBuild Basics
You join another build with includeBuild in settings.gradle. The path points at a directory containing its own settings file.
includeBuild("../shared-library")Dependency Substitution
The magic is automatic dependency substitution. When your project declares a dependency on a module that an included build produces, Gradle wires the in-source build in place of the published artifact.
dependencies {
implementation("com.acme:shared-library:1.0")
}Explicit Substitution
If group/name do not match, declare the mapping manually so Gradle knows which project replaces the coordinate.
includeBuild("../shared-library") {
dependencySubstitution {
substitute(module("com.acme:shared")).using(project(":"))
}
}Running Tasks Across Builds
You can invoke tasks from an included build using the :buildName:task syntax from the root.
gradle :shared-library:buildComposite vs Multi-Project
Use a multi-project build when modules always ship together. Use a composite when builds are independently versioned and released but you occasionally need them linked.
Plugin Development Workflow
Composite builds are the recommended way to test a custom plugin. Include the plugin build, and consuming projects pick up your local changes instantly.
includeBuild("../my-gradle-plugin")IDE Behavior
IntelliJ IDEA and Android Studio import composite builds as a single workspace, so navigation, refactoring, and debugging span all included builds seamlessly.
Limitations to Know
A few constraints apply:
- Included builds cannot themselves define the same root build
- A build cannot include itself (no cycles)
- Publishing tasks are not substituted, only consumable artifacts
Best Practices
Keep composites ergonomic:
- Use relative paths so teammates can clone side by side
- Keep coordinates consistent to rely on automatic substitution
- Document which builds are expected to be included
Quick Check
Test your understanding of composite builds.
Recap
You learned composite builds:
includeBuildjoins independent builds- Dependency substitution swaps artifacts for live source
- Ideal for cross-repo and plugin development
- Differs from multi-project: builds stay independently versioned
تعلم Groovy مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 12
- الدروس
- 48
الأسئلة الشائعة
هل درس «عمليات البناء المركبة وتركيب البناء» مجاني؟
نعم — نص درس «عمليات البناء المركبة وتركيب البناء» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Groovy & Gradle: JVM Automation and Build Engineering، انتقل إلى CoddyKit PRO. تتضمن دورة Groovy & Gradle: JVM Automation and Build Engineering 4 دروس في المجموع.
ماذا ستتعلم في «عمليات البناء المركبة وتركيب البناء»؟
اجمع عمليات بناء Gradle المستقلة في عملية واحدة باستخدام عمليات البناء المركبة (includeBuild)، ما يتيح لك تطوير المشاريع المترابطة واختبارها معًا دون نشر المصنوعات البرمجية. تتمرن على Groovy & Gradle: JVM Automation and Build Engineering مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Groovy & Gradle: JVM Automation and Build Engineering؟
لا تُشترط خبرة سابقة. Groovy & Gradle: JVM Automation and Build Engineering على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «عمليات البناء المركبة وتركيب البناء»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Groovy & Gradle: JVM Automation and Build Engineering هذا؟
نعم. كل درس في Groovy & Gradle: JVM Automation and Build Engineering يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- بنية مشروع Monorepo
- المشاريع الفرعية والإعدادات
- التبعيات بين المشاريع
- عمليات البناء المركبة وتركيب البناء