הגדרת אביזרי בדיקה לפרסום
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אומנם לא נדרשת הגדרה מסוימת כדי לפרסם אביזרי בדיקה
של הפרסום,
מנגנון יכולת
שמשמשים לטיפול באביזרים מחייבת הגדרה נוספת.
עבור פריט מידע שנוצר בתהליך פיתוח (Artifact) עם הקואורדינטות groupId:artifactId:version
, Gradle
מצפה שפריטי המידע שנוצרו בתהליך הבדיקה מצהירים על יכולת עם קואורדינטות
groupId:artifactId-test-fixtures:version
. עדיין לא בוצעה
באופן אוטומטי באמצעות התמיכה במתקן הבדיקה או באמצעות הפלאגין Maven Publish
ולכן צריך לבצע אותו באופן ידני.
Gradle יוצרת את היכולת לפי שם הפרויקט, הקבוצה והגרסה שלו.
צריך להגדיר את כל השלושה כך שיתאימו להגדרות של artifactId
, groupId
ו-version
באתר החדשות.
כברירת מחדל, שם הפרויקט הוא הקטע האחרון בנתיב שלו, לכן ברירת המחדל
שם הפרויקט עם הנתיב :path:to:mylibrary
הוא mylibrary
. אם כך
לא מה שבו רוצים להשתמש בשביל artifactId
, אז צריך לשנות את הפרויקט
שם.
יש שתי אפשרויות לשינוי שם של פרויקט:
- משנים את השם של תיקיית הפרויקט. הפעולה הזו משנה את שם הפרויקט, או
נתיב הפרויקט, כך שכל יחסי התלות בפרויקט צריכים להיות
עודכן. אם לא משנים את שם הפרויקט ואת התיקייה, אפשר ליצור
עבודה רבה יותר של ארגון מחדש בהתחלה, זה מפחית את הבלבול.
- לשנות את שם הפרויקט ב-Gradle בלי לשנות את השם של תיקיית הפרויקט. הזה
מבטלת את ההשפעה על ניהול גרסאות המקור, אבל מפצלת את מיקום הפרויקט
והשם שלו.
כדי לשנות את שם הפרויקט ב-Gradle, צריך להזין את הקוד הבא
קובץ settings.gradle
:
מגניב
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
מוגדר כברירת מחדל לשם ה-build, שהוא בדרך כלל השם של
תיקיית הבסיס, והערך version
לא צוין כברירת מחדל. כדי לשנות:
את הערכים של מזהה הקבוצה או של הגרסה, מגדירים את המאפיינים group
ו-version
,
בהתאמה, בקובץ build.gradle
ברמת הפרויקט (ל-Groovy) או
build.gradle.kts
(לסקריפט Kotlin):
מגניב
group = 'com.my-company'
version = '1.0'
Kotlin
group = "com.my-company"
version = "1.0"
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],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```"]]