cn.home1.tools:maven-settings-decoder-cipher

maven settings.xml decoder for gradle

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

cn.home1.tools
ArtifactId

ArtifactId

maven-settings-decoder-cipher
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

maven settings.xml decoder for gradle

Download maven-settings-decoder-cipher

How to add to project

<!-- https://jarcasting.com/artifacts/cn.home1.tools/maven-settings-decoder-cipher/ -->
<dependency>
    <groupId>cn.home1.tools</groupId>
    <artifactId>maven-settings-decoder-cipher</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/cn.home1.tools/maven-settings-decoder-cipher/
implementation 'cn.home1.tools:maven-settings-decoder-cipher:1.1.0'
// https://jarcasting.com/artifacts/cn.home1.tools/maven-settings-decoder-cipher/
implementation ("cn.home1.tools:maven-settings-decoder-cipher:1.1.0")
'cn.home1.tools:maven-settings-decoder-cipher:jar:1.1.0'
<dependency org="cn.home1.tools" name="maven-settings-decoder-cipher" rev="1.1.0">
  <artifact name="maven-settings-decoder-cipher" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.home1.tools', module='maven-settings-decoder-cipher', version='1.1.0')
)
libraryDependencies += "cn.home1.tools" % "maven-settings-decoder-cipher" % "1.1.0"
[cn.home1.tools/maven-settings-decoder-cipher "1.1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.sonatype.plexus : plexus-cipher jar 1.7

test (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

maven-settings-decoder

===========================================================================

A tool to decrypt the XML node text stored in maven settings.xml files

Inspired by jelmerk/maven-settings-decoder

Maven 2.1.0+ supports server password encryption

This tool lets you decrypt these encrypted text as long as you have access to both the settings.xml file and the settings-security.xml file.

usage: maven-settings-decoder
 -s,--settings <arg>             location of settings.xml file.
 -ss,--settings-security <arg>   location of settings-security.xml.
 -x,--xml-path <arg>             xpath expression, only node text is supported.

or set '-s' and '-ss' in MAVEN_SETTINGS environment variable.

Use as a command-line tool:

java -jar maven-settings-decoder-cli/target/maven-settings-decoder-cli-*-exec.jar \
    -s "${HOME}/.m2/settings.xml" \
    -ss "${HOME}/.m2/settings-security.xml" \
    -x "/settings/servers/server[id='private-nexus3-releases']/password/text()"

# or

java -jar maven-settings-decoder-cli/target/maven-settings-decoder-cli-*-exec.jar \
    -s "${HOME}/.m2/settings.xml" \
    -ss "${HOME}/.m2/settings-security.xml" \
    -x "//server[id='private-nexus3-releases']/password/text()"

Use as gradle buildscript dependency, so we can access maven's settings.xml from our build script:

    buildscript {
      // cn.home1.tools:maven-settings-decoder is in maven central.
      mavenCentral()
      // use sonatype-snapshots to get cn.home1.tools:maven-settings-decoder snapshot versions
      //maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
      dependencies {
        ...
        classpath 'cn.home1.tools:maven-settings-decoder-cli:1.1.0'
      }
    }
    ...
    ext.mavenSettings = new cn.home1.tools.maven.SettingsDecoder();
    ext.nexusSnapshotsUser = mavenSettings.getText("//server[id='${nexus}-snapshots']/username/text()")
    ext.nexusSnapshotsPass = mavenSettings.getText("//server[id='${nexus}-snapshots']/password/text()")
    println "${nexus}-snapshots username: " + mavenSettings.getText("//server[id='${nexus}-snapshots']/username/text()")
    println "${nexus}-snapshots password: " + mavenSettings.getText("//server[id='${nexus}-snapshots']/password/text()")
    ...

Build this package

./mvnw -s settings.xml clean install
CI_OPT_OSSRH_NEXUS2_USER=user CI_OPT_OSSRH_NEXUS2_PASS=password ./mvnw -Dgpg.executable=gpg -Dgpg.loopback=true -s settings.xml clean deploy
cn.home1.tools

Versions

Version
1.1.0