Github Action to create maven settings (~/.m2/settings.xml).
Supports <servers>, <repositories>, <pluginRepositories>, <pluginGroups>, <mirrors>, <activeProfiles>, <proxies>, and <profiles>.
Inputs
servers
Optional json array of servers to add to settings.xml.
id - The ID of the server (not of the user to login as) that matches the id element of the repository/mirror that Maven tries to connect to.
username, password - These elements appear as a pair denoting the login and password required to authenticate to this server.
privateKey, passphrase - Like the previous two elements, this pair specifies a path to a private key (default is ${user.home}/.ssh/id_dsa) and a passphrase, if required.
filePermissions, directoryPermissions - When a repository file or directory is created on deployment, these are the permissions to use. The legal values of each is a three digit number corresponding to *nix file permissions, e.g. 664, or 775.
configuration - Any additional custom configuration for server in JSON format.
id - The unique identifier of this mirror. The id is used to differentiate between mirror elements and to pick the corresponding credentials from the <servers> section when connecting to the mirror.
mirrorOf - The id of the repository that this is a mirror of. For example, to point to a mirror of the Maven central repository (https://repo.maven.apache.org/maven2/), set this element to central. More advanced mappings like repo1,repo2 or *,!inhouse are also possible. This must not match the mirror id.
url - The base URL of this mirror. The build system will use this URL to connect to a repository rather than the original repository URL.
Optional json array of profiles to add to settings.xml
The profile element in the settings.xml is a truncated version of the pom.xmlprofile element. It consists of the activation, repositories, pluginRepositories and properties elements. The profile elements only include these four elements because they concerns themselves with the build system as a whole (which is the role of the settings.xml file), not about individual project object model settings.
Optional json array of active profiles to add to settings.xml
Set of activeProfile elements, which each have a value of a profileid. Any profileid defined as an activeProfile will be active, regardless of any environment settings. If no matching profile is found nothing will happen. For example, if env-test is an activeProfile, a profile in a pom.xml (or profile.xml) with a corresponding id will be active. If no such profile is found then execution will continue as normal.
Optional json array of proxies to add to settings.xml.
id - The unique identifier for this proxy. This is used to differentiate between proxy elements.
active - true if this proxy is active. This is useful for declaring a set of proxies, but only one may be active at a time.
protocol, host, port - The protocol://host:port of the proxy, separated into discrete elements.
username, password - These elements appear as a pair denoting the login and password required to authenticate to this proxy server.
nonProxyHosts - This is a list of hosts which should not be proxied. The delimiter of the list is the expected type of the proxy server; the example above is pipe delimited - comma delimited is also common.
The generated settings.xml will be created at /home/runner/work/{repo}/foo/custom.xml, which can be referenced in maven steps using mvn --settings foo/custom.xml {goal}.
请发表评论