簡體   English   中英

如何在 Maven 中為 scm:checkin 目標使用 basedir 和 workingDirectory 參數?

[英]How to use basedir and workingDirectory parameters for scm:checkin goal in Maven?

我對 Maven 非常陌生,我對 Maven SCM 插件的basedirworkingDirectory參數的用途和正確用法感到困惑。 假設我有以下文件/文件夾結構(在 Windows 中):

C:\fruits\
├───.git\
├───apples\
│   └───pom.xml
└───oranges\
    └───pom.xml

Before executing Maven (by invoking mvn.cmd from the command line), I change the current directory in shell to " C:\fruits\apples ". 因此,在 Maven 的術語中,“ C:\fruits\apples ”成為工作目錄,其中包含用於apples項目的相應pom.xml文件。 另一方面,在 Git 的術語中,工作目錄是“ C:\fruits ”,因為這是整個 monorepo 分支的檢出位置。

在構建過程中的某個時刻,我使用 Maven SCM 插件來推送一些修改。 目前,在指定scm:checkin目標時,我提供--define workingDirectory="C:\fruits" ,但我不確定這是否是正確的路徑。 此外,即使我目前根本沒有定義basedir參數,該插件似乎也可以工作,這令人驚訝,因為文檔basedir列為唯一必需的參數。 不幸的是,文檔沒有解釋basedir參數的用途(他們只是說它是“基本目錄”,duh),也沒有解釋哪個“工作目錄”(即,無論是在 Git 的意義上還是在 Maven 的意義上) workingDirectory參數應該指向。

您能否向我解釋一下,我應該定義 SCM 插件的basedirworkingDirectory參數指向哪些路徑(而 Maven 正在處理我的apples項目)以及為什么?

SCM 插件的working directory參數在 Git 的上下文中,即.git 文件夾的位置

basedir是 pom.xml 所在位置的目錄。 Maven 有許多默認屬性,其中之一是basedir

要了解有關它如何實現的更多信息,您還可以從 maven 中心查看此插件的代碼,或查看您的本地 maven 存儲庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM