ضبط إعدادات اختبار النشر
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
رغم أن نشر تركيبات الاختبار لا يتطلب أي تهيئة معينة
جهة النشر
آلية الإمكانيات
المستخدم لمعالجة التجهيزات يتطلب تهيئة إضافية.
بالنسبة إلى قطعة أثرية معينة مع الإحداثيات groupId:artifactId:version
، ستركز غرادل
أن تعلن أدوات الاختبار عن إمكانية في الإحداثيات
groupId:artifactId-test-fixtures:version
لم يتم إجراء ذلك في الوقت الحالي
تلقائيًا إما عن طريق دعم تركيبات الاختبار أو المكوّن الإضافي Maven Publish،
وبالتالي يجب إجراؤها يدويًا.
تنشئ Gradle الإمكانات من اسم المشروع ومجموعته وإصداره.
يجب إعداد الثلاثة لتتطابق مع المجموعة artifactId
وgroupId
وversion
.
في جهة النشر
ويكون اسم المشروع هو الجزء الأخير من مساره افتراضيًا، وبالتالي
اسم مشروع بالمسار :path:to:mylibrary
هو mylibrary
. إذا كانت هذه هي الحالة
وليس ما تريد استخدامه في artifactId
، ستحتاج إلى تغيير مشروعك.
الاسم.
هناك خياران لإعادة تسمية مشروعك:
- أعد تسمية مجلد المشروع. يؤدي هذا إلى تغيير اسم المشروع
مسار Gradle للمشروع، لذلك يجب أن تكون جميع التبعيات على المشروع
تحديث. مع الاحتفاظ باسم المشروع والمجلد كما هو قد يؤدي إلى إنشاء
المزيد من أعمال إعادة التنظيم في البداية، فإنه يقلل من الالتباس.
- أعد تسمية المشروع في Gradle بدون إعادة تسمية مجلد المشروع. هذا النمط
بدون التأثير على تحديد نُسَخ المصدر، لكنّه يقسّم موقع المشروع
والاسم.
لإعادة تسمية المشروع في Gradle، أدخل التعليمة البرمجية التالية في
ملف settings.gradle
:
Groovy
include ':path:to:mylibrary'
project(':path:to:mylibrary').name = 'my-library'
Kotlin
include(":path:to:mylibrary")
project(":path:to:mylibrary").name = "my-library"
يعيّن هذا الرمز المسار الجديد للمشروع إلى :path:to:my-library
.
يتم ضبط القيمة groupId
تلقائيًا على اسم الإصدار، وهو اسم
المجلد الجذر، وتكون القيمة version
غير محددة تلقائيًا. لتغيير
قيم رقم تعريف المجموعة أو إصدارها، وضبط السمتَين group
وversion
،
على التوالي، في ملف build.gradle
على مستوى المشروع (لتطبيق Groovy) أو
build.gradle.kts
(لنص Kotlin):
Groovy
group = 'com.my-company'
version = '1.0'
Kotlin
group = "com.my-company"
version = "1.0"
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Configure test fixtures for publication\n\nWhile publishing test fixtures doesn't require any particular configuration\nof the publication, the\n[capability mechanism](https://docs.gradle.org/current/userguide/component_capabilities.html)\nused to handle fixtures does require an additional configuration.\n\nFor a given artifact with coordinates `groupId:artifactId:version`, Gradle\nexpects that the test fixtures artifact declares a capability with coordinates\n`groupId:artifactId-test-fixtures:version`. This is not currently done\nautomatically by either the test fixture support or the Maven Publish Plugin,\nand therefore must be done manually.\n\nGradle creates the capability from the project's name, group, and version.\nAll three must be set up to match the `artifactId`, `groupId`, and `version` set\nin the publication.\n\nThe project's name is the last segment of its path by default, so the default\nname of a project with the path `:path:to:mylibrary` is `mylibrary`. If this is\nnot what you want to use for `artifactId`, then you need to change your project\nname.\n\nThere are two options for renaming your project:\n\n- Rename the folder of the project. This changes the project name, or the Gradle path of the project, so all dependencies on the project need to be updated. While keeping the project name and folder the same might create more reorganization work initially, it reduces confusion.\n- Rename the project in Gradle without renaming the folder of the project. This avoids the impact on source versioning, but it splits the project location and name.\n\nTo rename the project in Gradle, insert the following code in the\n`settings.gradle` file: \n\n### Groovy\n\n```groovy\ninclude ':path:to:mylibrary'\nproject(':path:to:mylibrary').name = 'my-library'\n```\n\n### Kotlin\n\n```kotlin\ninclude(\":path:to:mylibrary\")\nproject(\":path:to:mylibrary\").name = \"my-library\"\n```\n\nThis code assigns the new path of the project to `:path:to:my-library`.\n\nThe value `groupId` defaults to the build name, which is generally the name of\nthe root folder, and the value `version` is by default unspecified. To change\nthe values of the group ID or version, set the `group` and `version` properties,\nrespectively, in your project-level `build.gradle` file (for Groovy) or\n`build.gradle.kts` (for Kotlin script): \n\n### Groovy\n\n```groovy\ngroup = 'com.my-company'\nversion = '1.0'\n```\n\n### Kotlin\n\n```kotlin\ngroup = \"com.my-company\"\nversion = \"1.0\"\n```"]]