All Projects → whelk-io → maven-settings-xml-action

whelk-io / maven-settings-xml-action

Licence: Apache-2.0 license
Github Action to create maven settings (~/.m2/settings.xml)

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to maven-settings-xml-action

metadatamanagement
Metadatamanagement (MDM) - Data Search for Higher Education Research and Science Studies
Stars: ✭ 21 (-56.25%)
Mutual labels:  maven, github-actions
maven-settings-action
This action setup maven settings.xml
Stars: ✭ 39 (-18.75%)
Mutual labels:  maven, github-actions
jcabi-mysql-maven-plugin
MySQL Maven Plugin: starts MySQL server on pre-integration phase and shuts it down on post-integration phase
Stars: ✭ 34 (-29.17%)
Mutual labels:  maven
restdocs-spec
A maven plugin for generating Open API and Postman Collection specifications using Spring Restdocs.
Stars: ✭ 43 (-10.42%)
Mutual labels:  maven
vue3-md-blog
✍️ Minimal config Vue3 + Markdown blog engine
Stars: ✭ 53 (+10.42%)
Mutual labels:  github-actions
buildnumber-maven-plugin
BuildNumber Maven Plugin
Stars: ✭ 53 (+10.42%)
Mutual labels:  maven
impsort-maven-plugin
Java import sorter plugin. Sort your imps!
Stars: ✭ 31 (-35.42%)
Mutual labels:  maven
action-brakeman
Run brakeman with reviewdog 🐶
Stars: ✭ 22 (-54.17%)
Mutual labels:  github-actions
actions-publish-gh-pages
🍣 A GitHub Action to publish static website using GitHub Pages
Stars: ✭ 12 (-75%)
Mutual labels:  github-actions
deploy-cloudrun
This action deploys your container image to Cloud Run.
Stars: ✭ 238 (+395.83%)
Mutual labels:  github-actions
apprise-ga
GitHub Action to send a dynamic push notification to every single platform thanks to the Apprise library
Stars: ✭ 18 (-62.5%)
Mutual labels:  github-actions
scan-action
Anchore container analysis and scan provided as a GitHub Action
Stars: ✭ 140 (+191.67%)
Mutual labels:  github-actions
Data-pipeline-project
Data pipeline project
Stars: ✭ 18 (-62.5%)
Mutual labels:  maven
hackernews-button
Privacy-preserving Firefox extension linking to Hacker News discussion; built with Bloom filters and WebAssembly
Stars: ✭ 73 (+52.08%)
Mutual labels:  github-actions
mosec-maven-plugin
用于检测maven项目的第三方依赖组件是否存在安全漏洞。
Stars: ✭ 85 (+77.08%)
Mutual labels:  maven
setup-jdk
(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK
Stars: ✭ 32 (-33.33%)
Mutual labels:  github-actions
codeclimate-action
GitHub Action to send your code coverage to CodeClimate
Stars: ✭ 145 (+202.08%)
Mutual labels:  github-actions
csharp-docs-generator
An action that generates html documentation for C# programs to use for GitHub pages.
Stars: ✭ 21 (-56.25%)
Mutual labels:  github-actions
dart-package-publisher
Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
Stars: ✭ 45 (-6.25%)
Mutual labels:  github-actions
pangyo-smilecook
🍱 Github Actions를 활용한 판교 한식뷔페 스마일쿡 식단 슬랙봇
Stars: ✭ 12 (-75%)
Mutual labels:  github-actions

maven-settings-xml-action

CodeFactor build-test CodeQL

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.

Reference: Maven Settings > Servers

mirrors

  • 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.

Reference: Maven Settings > Mirrors

repositories

Optional json array of repositories to add to settings.xml

  • id - The ID of the repository that matches the id element of the server.
  • name - Name of the repository.
  • url - URL to connect to repository.
  • releases.enabled - Enable release policy.
  • snapshots.enabled - Enable snapshot policy.

When not repostories is empty or null, the Maven Central repository is applied by default:

repositories: |
  [
    {
      "id": "central",
      "name": "Maven Central",
      "url": "https://repo1.maven.org/maven2",
      "releases": {
        "enabled": "true"
      },
      "snapshots": {
        "enabled": "false"
      }
    }
  ]

Reference: Maven Settings > Repositories

plugin_repositories

Optional json array of repositories to add to settings.xml

  • id - The ID of the repository that matches the id element of the server.
  • name - Name of the repository.
  • url - URL to connect to repository.
  • releases.enabled - Enable release policy.
  • snapshots.enabled - Enable snapshot policy.

Reference: Maven Settings > Plugin Repositories

plugin_groups

Optional json array of plugin groups to add to settings.xml

Reference: Maven Settings > Plugin Groups

profiles

Optional json array of profiles to add to settings.xml

The profile element in the settings.xml is a truncated version of the pom.xml profile 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.

Reference: Maven Settings > Profiles

active_profiles

Optional json array of active profiles to add to settings.xml

Set of activeProfile elements, which each have a value of a profile id. Any profile id 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.

Reference: Maven Settings > Active Profiles

proxies

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.

Reference: Maven Settings > Proxies

output_file

Optional String path of to generate settings.xml. By default, ~/.m2/settings.xml is used.

When using a custom output_file, for example:

- uses: whelk-io/maven-settings-xml-action@v20
  with:
    output_file: foo/custom.xml

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}.


Basic Usage

- name: maven-settings-xml-action
  uses: whelk-io/maven-settings-xml-action@v20
  with:
    repositories: '[{ "id": "some-repository", "url": "http://some.repository.url" }]'
    plugin_repositories: '[{ "id": "some-plugin-repository", "url": "http://some.plugin.repository.url" }]'
    servers: '[{ "id": "some-server", "username": "some.user", "password": "some.password" }]'

Output

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
    <activeProfiles>
        <activeProfile>github</activeProfile>
    </activeProfiles>
  
    <profiles>
        <profile>
            <id>github</id>
            <repositories>
                <repository>
                    <id>some-repository</id>
                    <url>http://some.repository.url</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>some-plugin-repository</id>
                    <url>http://some.plugin.repository.url</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
  
    <servers>
        <server>
            <id>foo</id>
            <username>fu</username>
            <password>bar</password>
        </server>
    </servers>
  
</settings>

Full Usage

- name: maven-settings-xml-action
  uses: whelk-io/maven-settings-xml-action@v20
  with:
    repositories: >
      [
        {
          "id": "some-repository",
          "name": "some-repository-name",
          "url": "http://some.repository.url",
          "releases": {
            "enabled": "true",
            "updatePolicy": "always",
            "checksumPolicy": "fail"
          },
          "snapshots": {
            "enabled": "false",
            "updatePolicy": "always",
            "checksumPolicy": "fail"
          }
        }
      ]
    plugin_repositories: >
      [
        {
          "id": "some-plugin-repository",
          "name": "some-plugin-repository-name",
          "url": "http://some.plugin.repository.url",
          "releases": {
            "enabled": "true"
          },
          "snapshots": {
            "enabled": "false"
          }
        }
      ]
    servers: >
      [
        {
          "id": "some-id",
          "username": "${env.USER}",
          "password": "${env.PASS}",
          "configuration": {
            "httpConfiguration": {
              "all": {
                "usePreemptive": "true"
              }
            }
          }
        }
      ]
    mirrors: >
      [
        {
          "id": "nexus",
          "mirrorOf": "!my-org-snapshots,*",
          "url": "http://redacted/nexus/content/groups/public"
        }
      ]
    profiles: >
      [
        {
          "id": "foo.profile",
          "name": "foo.profile",
          "url": "http://foo.bar.profile",
          "properties": {
            "foo": "property-1",
            "bar": "property-2"
          }
        }
      ]
    plugin_groups: >
      [
        "some.plugin.group.id",
        "some.other.plugin.group.id"
      ]
    proxies: >
      [
        {
          "id": "foo-proxy",
          "active": "true",
          "protocol": "http",
          "host": "https://proxy.example.com",
          "port": "443",
          "username": "foo",
          "password": "bar",
          "nonProxyHosts": "noproxy1.example.com|noproxy2.example.com"
        }
      ]
    active_profiles: >
      [
        "some-profile"
      ]
    output_file: .m2/settings.xml

Output

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
    <activeProfiles>
        <activeProfile>some-profile</activeProfile>
    </activeProfiles>
  
    <profiles>
        <profile>
            <id>github</id>
            <repositories>
                <repository>
                    <id>some-repository</id>
                    <name>some-repository-name</name>
                    <url>http://some.repository.url</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>fail</checksumPolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>some-plugin-repository</id>
                    <name>some-plugin-repository-name</name>
                    <url>http://some.plugin.repository.url</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>
            <id>foo.profile</id>
            <name>foo.profile</name>
            <url>http://foo.bar.profile</url>
            <properties>
                <foo>property-1</foo>
                <bar>property-2</bar>
            </properties>
        </profile>
    </profiles>
  
    <servers>
        <server>
            <id>foo</id>
            <username>fu</username>
            <password>bar</password>
            <privateKey>${user.home}/.ssh/id_dsa</privateKey>
            <passphrase>some_passphrase</passphrase>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <httpConfiguration>
                    <all>
                        <usePreemptive>true</usePreemptive>
                    </all>
                </httpConfiguration>
            </configuration>
        </server>
    </servers>
  
    <mirrors>
        <mirror>
            <id>nexus</id>
            <mirrorOf>!my-org-snapshots,*</mirrorOf>
            <url>http://redacted/nexus/content/groups/public</url>
        </mirror>
    </mirrors>
  
    <pluginGroups>
        <pluginGroup>some.plugin.group.id</pluginGroup>
        <pluginGroup>some.other.plugin.group.id</pluginGroup>
    </pluginGroups>

    <proxies>
        <proxy>
            <id>foo-proxy</id>
            <active>true</active>
            <protocol>http</protocol>
            <host>https://proxy.example.com</host>
            <port>443</port>
            <username>foo</username>
            <password>bar</password>
            <nonProxyHosts>noproxy1.example.com|noproxy2.example.com</nonProxyHosts>
        </proxy>
    </proxies>
  
</settings>

Local Setup

See CONTRIBUTING.md for guidelines for forking and contributing to this project.

Install Dependencies

npm ci

Run Linter

npm run lint

Run Unit-Tests

npm test

Create Distribution

npm run build

Run Actions Locally

Install Act

brew install act

Run Step

act -s GITHUB_TOKEN={token} -j {step}

Example: act -s GITHUB_TOKEN=lk34j56lk34j5lk34j5dkllsldf -j test-basic

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].