public abstract class AbstractCrowdinMojo
extends org.apache.maven.plugin.AbstractMojo
Mojos.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.http.impl.client.CloseableHttpClient |
client
The HTTP client
|
protected String |
comment
The custom comment header to add to translation files if
AbstractFileSet.addComment is true. |
protected String |
crowdinServerId
Server id in settings.xml, whose
<password> is the API token to
use. |
protected Boolean |
disableBranches
Disables branches and the reliance on Git
|
protected File |
downloadFolder
The folder where the downloaded language files should be placed.
|
protected Path |
downloadFolderPath
The folder where the downloaded language files should be places as a
Path. |
protected String |
gitBaseFolder
The Git base folder, if different from Maven project base folder
|
protected Integer |
httpTimeout
The HTTP timeout in seconds
|
protected String |
lineSeparator
The string to use as line separator.
|
protected org.apache.maven.execution.MavenSession |
mavenSession
The Maven Session object
|
protected org.apache.maven.project.MavenProject |
project
The current Maven project
|
protected long |
projectId
The Project Id, can be found on Crowdin under Tools -> API.
|
protected String |
rootBranch
The git branch that should be treated as root in Crowdin versions
management.
|
protected org.apache.maven.settings.Server |
server
The
Server to use for Crowdin credentials |
protected List<StatusFile> |
statusFiles
A list of
StatusFile elements that defines status files. |
protected List<TranslationFileSet> |
translationFileSets
A list of
TranslationFileSet elements that defines a set of
translation files. |
| Constructor and Description |
|---|
AbstractCrowdinMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanDownloadFolder()
Deletes all files and folders in
downloadFolder. |
protected void |
createClient()
Initializes
client with a new CloseableHttpClient
instance unless one has already been created. |
protected BranchInfo |
getBranch()
Gets the Crowdin branch name that matches the name of the current Git
branch.
|
protected BranchInfo |
getBranch(boolean create,
List<BranchInfo> branches)
Creates or gets the Crowdin branch name that matches the name of the
current Git branch.
|
protected String |
getPluginVersion()
Retrieves the version of this plugin from Maven's
pluginDescriptor. |
protected void |
initializeParameters()
Initializes the
Mojo parameters since they are set via reflection
and can't be handled in the constructor. |
protected void |
initializeServer()
Initializes
server by retrieving the appropriate Server
instance from the Maven settings and validating its settings. |
protected void |
setClient(org.apache.http.impl.client.CloseableHttpClient client)
Sets the
CloseableHttpClient. |
protected void |
setComment(String comment)
Sets the
comment value. |
protected void |
setCrowdinServerId(String serverId)
Sets the
crowdinServerId value. |
protected void |
setDisableBranches(Boolean disableBranches)
Sets the
disableBranches value. |
protected void |
setDownloadFolder(File folder)
Sets the
downloadFolder and downloadFolderPath values. |
protected void |
setDownloadFolder(Path folder)
Sets the
downloadFolder and downloadFolderPath values. |
protected void |
setGitBaseFolder(String gitBaseFolder)
Sets the Git base folder.
|
protected void |
setHTTPTimeout(Integer timeout)
Sets the HTTP timeout value.
|
protected void |
setLineSeparator(String lineSeparator)
Sets the
lineSeparator value. |
protected void |
setProject(org.apache.maven.project.MavenProject value)
Sets the
project value. |
protected void |
setProjectId(long projectId)
Sets the
projectId value. |
protected void |
setRootBranch(String branch)
Sets the
rootBranch value. |
protected void |
setServer(org.apache.maven.settings.Server server)
Sets the
Server to use for Crowdin credentials. |
protected void |
setStatusFiles(List<StatusFile> statusFiles)
Sets the
StatusFiles. |
protected void |
setTranslationFileSets(List<TranslationFileSet> translationFileSets)
Sets the
TranslationFileSets. |
getLog, getPluginContext, setLog, setPluginContext@Parameter(defaultValue="${session}",
required=true,
readonly=true)
protected org.apache.maven.execution.MavenSession mavenSession
@Parameter(defaultValue="${project}",
required=true,
readonly=true)
protected org.apache.maven.project.MavenProject project
@Parameter(property="timeout") protected Integer httpTimeout
@Parameter(property="downloadFolder",
required=true)
protected File downloadFolder
protected Path downloadFolderPath
Path. Since Maven doesn't seem to be able to handle Path
as a parameter, the File downloadFolder is used as an
intermediate.@Parameter(property="comment") protected String comment
AbstractFileSet.addComment is true. If not configured,
a generic "do not modify" comment will be added.@Parameter(property="lineSeparator") protected String lineSeparator
\n, \r or
\r\n as needed. If not specified, the default will be used.@Parameter(defaultValue="false") protected Boolean disableBranches
@Parameter protected String gitBaseFolder
@Parameter(property="rootBranch",
defaultValue="master")
protected String rootBranch
@Parameter(property="crowdinServerId",
required=true)
protected String crowdinServerId
<password> is the API token to
use.@Parameter(property="projectId",
required=true)
protected long projectId
@Parameter(property="translationFileSets",
required=true)
protected List<TranslationFileSet> translationFileSets
TranslationFileSet elements that defines a set of
translation files.@Parameter(property="statusFiles",
required=true)
protected List<StatusFile> statusFiles
StatusFile elements that defines status files.protected org.apache.http.impl.client.CloseableHttpClient client
protected org.apache.maven.settings.Server server
Server to use for Crowdin credentialsprotected void setProject(org.apache.maven.project.MavenProject value)
project value.value - the MavenProject to set.protected void setHTTPTimeout(Integer timeout)
timeout - the timeout value in seconds.protected void setDownloadFolder(Path folder)
downloadFolder and downloadFolderPath values.folder - the Path representing a folder to set.protected void setDownloadFolder(File folder)
downloadFolder and downloadFolderPath values.folder - the File representing a folder to set.protected void setComment(String comment)
comment value.comment - the comment to set.protected void setLineSeparator(String lineSeparator)
lineSeparator value.lineSeparator - the line-separator to set.protected void setDisableBranches(Boolean disableBranches)
disableBranches value.disableBranches - true to disable branches, false
otherwise.protected void setGitBaseFolder(String gitBaseFolder)
gitBaseFolder - the Git base folder to set.protected void setRootBranch(String branch)
rootBranch value.branch - the Git root branch name.protected void setCrowdinServerId(String serverId)
crowdinServerId value.serverId - The Maven server id to set.crowdinServerIdprotected void setProjectId(long projectId)
projectId value.projectId - the project id to set.projectIdprotected void setTranslationFileSets(List<TranslationFileSet> translationFileSets)
TranslationFileSets.translationFileSets - the TranslationFileSets to set.protected void setStatusFiles(List<StatusFile> statusFiles)
StatusFiles.statusFiles - the StatusFiles to set.protected void setClient(org.apache.http.impl.client.CloseableHttpClient client)
CloseableHttpClient.client - the CloseableHttpClient to set.protected void setServer(org.apache.maven.settings.Server server)
Server to use for Crowdin credentials.server - the Server to set.protected void initializeServer()
throws org.apache.maven.plugin.MojoExecutionException
server by retrieving the appropriate Server
instance from the Maven settings and validating its settings.org.apache.maven.plugin.MojoExecutionException - If a required parameter is missing or the
specified crowdinServerId isn't configured.protected void createClient()
throws org.apache.maven.plugin.MojoExecutionException
client with a new CloseableHttpClient
instance unless one has already been created.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.protected String getPluginVersion()
pluginDescriptor.String with current version.protected void initializeParameters()
throws org.apache.maven.plugin.MojoExecutionException
Mojo parameters since they are set via reflection
and can't be handled in the constructor.org.apache.maven.plugin.MojoExecutionException - If an error occurs during initialization.@Nullable protected BranchInfo getBranch() throws org.apache.maven.plugin.MojoExecutionException
BranchInfo or null if the current git
branch is the Crowdin root.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nullable protected BranchInfo getBranch(boolean create, @Nullable List<BranchInfo> branches) throws org.apache.maven.plugin.MojoExecutionException
create - whether the branch should be created at Crowdin if it
doesn't exist.branches - a List of BranchInfo if it's already
possessed, null to make this method retrieve it.BranchInfo or null if the current git branch
is the Crowdin root, or if branches are disabled.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.protected void cleanDownloadFolder()
throws org.apache.maven.plugin.MojoExecutionException
downloadFolder.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.Copyright © 2024. All rights reserved.