Class OnePasswordExtension

java.lang.Object
io.github.arve0.onepassword.properties.OnePasswordExtension

public class OnePasswordExtension extends Object
Extension that provides a unified API to access project properties as lazy Provider<String>.

Access via onePassword.property("KEY") in any build script where this plugin is applied. The returned provider resolves identically regardless of whether the value came from gradle.properties, an ORG_GRADLE_PROJECT_* environment variable, or a -P flag.

  • Plain string values are wrapped in an eager Provider<String>.
  • op:// references are resolved lazily via the 1Password CLI.
  • Constructor Details

    • OnePasswordExtension

      public OnePasswordExtension(org.gradle.api.Project project, io.github.arve0.onepassword.properties.OpCliClient cli)
      Parameters:
      project - the Gradle project this extension is attached to
      cli - the 1Password CLI client used to resolve op:// references
  • Method Details

    • property

      public org.gradle.api.provider.Provider<String> property(String key)
      Returns a Provider<String> for the given project property key.

      The returned provider behaves the same regardless of the property source: gradle.properties, environment variable (ORG_GRADLE_PROJECT_*), or -P.

      If the property value starts with op://, the provider resolves the secret via the 1Password CLI when .get() is called. For plain string values, the provider returns the value directly.

      Parameters:
      key - the project property key
      Returns:
      a Provider<String> for the property value
      Throws:
      PropertyResolutionException - if the property is not set