question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maven publish: env variables enforced that are not needed

See original GitHub issue

Hey,

I’m not entirely sure if this is the right place to report the issue. Let me know if it should be elsewhere.

The generated publish:maven step (i assume its coming from: https://github.com/projen/projen/blob/63f89f0d7adbc853a2caeac16de63cac75e257be/src/release/publisher.ts#L246) is generating a section in tasks.json like this:

    "publish:maven": {
      "name": "publish:maven",
      "description": "Publish this package to Maven Central",
      "env": {
        "MAVEN_ENDPOINT": "https://myscustomurl.com",
        "MAVEN_REPOSITORY_URL": "https://myscustomurl.com"
      },
      "requiredEnv": [
        "MAVEN_GPG_PRIVATE_KEY",
        "MAVEN_GPG_PRIVATE_KEY_PASSPHRASE",
        "MAVEN_PASSWORD",
        "MAVEN_USERNAME",
        "MAVEN_STAGING_PROFILE_ID"
      ],
      "steps": [
        {
          "exec": "npx -p jsii-release@latest jsii-release-maven"
        }
      ]
    },

This results in

🤖 missing required environment variables: MAVEN_GPG_PRIVATE_KEY,MAVEN_GPG_PRIVATE_KEY_PASSPHRASE,MAVEN_PASSWORD,MAVEN_USERNAME,MAVEN_STAGING_PROFILE_ID

when running npx projen publish:maven This does not work for repositories where not maven central is used, and only there the GPG signing is supported.

the publish works perfectly fine when setting the env vars manually, eg like that:

export MAVEN_ENDPOINT="https://myscustomurl.comrepository/maven/",
export MAVEN_REPOSITORY_URL="https://myscustomurl.com/repository/maven-releases/"
export MAVEN_SERVER_ID="nexus"
export MAVEN_USERNAME="foobar"
export MAVEN_PASSWORD="CHANGEME"

npx -p jsii-release@latest jsii-release-maven

But fails as soon any of the GPG variables is set:

export MAVEN_GPG_PRIVATE_KEY="sfhgjk"

❌ Package signing is currently only supported for Maven Central

projen version: 0.30.5

tl;dr:

Is there an option to not make the gpg env variables mandatory for the npm publish step?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
github-actions[bot]commented, Dec 25, 2021

This issue is now marked as stale because it hasn’t seen activity for a while. Add a comment or it will be closed soon.

0reactions
github-actions[bot]commented, Jan 1, 2022

Closing this issue as it hasn’t seen activity for a while. Please add a comment @mentioning a maintainer to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache Maven Enforcer Built-In Rules – Require Environment ...
This rule checks that a specified environment variable is set. The following parameters are supported by this rule: message - an optional ...
Read more >
How to identify and set a missing environment property in ...
If you want to make sure that the property value is ALWAYS supplied on a command line, then you can use maven-enforcer-plugin. Here...
Read more >
Maven Enforcer Plugin - Baeldung
With the requireEnvironmentVariable rule, we can ensure that a certain environment variable is set in the execution environment. It can be ...
Read more >
Maven packages in the Package Registry - GitLab Docs
Publish Maven artifacts in your project's Package Registry. Then, install the packages whenever you need to use them as a dependency.
Read more >
Environment variables not picked up by signing plugin #149
Caused by: org.gradle.api.InvalidUserDataException: Cannot perform signing task ':interactor:signMavenPublication' because it has no configured signatory at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found