GMavenPlus

repository·master·Indexed 43 days ago

https://github.com/groovy/gmavenplus

A Maven plugin that enables the integration of Groovy into Maven projects, allowing for Groovy compilation and execution within the Maven build lifecycle. It is a rewrite of the original GMaven plugin.

Tokens
1.8K
Snippets
3
Records
7
Agent score
5%

What's inside GMavenPlus

  1. Introduction to GMavenPlus

    master
    GMavenPlus is a Maven plugin designed to integrate Groovy into Maven-based projects. It is a rewrite of the original GMaven plugin and provides the necessary tooling to compile and run Groovy code within a Maven lifecycle.
  2. Run routine development tasks with Maven Wrapper

    master

    Use the Maven Wrapper (./mvnw on Unix/macOS or ./mvnw.cmd on Windows) for all routine development tasks to ensure consistent environment behavior.

    Common Development Commands

    TaskCommand
    Run unit tests<mvnw> test
    Run a specific test class<mvnw> -Dtest=ClassNameTest test
    Run the full test suite (including integration tests)<mvnw> -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true clean install invoker:install invoker:run
    Run integration tests only<mvnw> -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true clean install invoker:install invoker:run
    Run selected integration projects<mvnw> -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true -Dinvoker.test=basicCompile,advancedCompile clean install invoker:install invoker:run
    Install without tests or Invoker projects<mvnw> -Dmaven.test.skip=true -Dinvoker.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dgpg.skip=true clean install
    # Example: Running a specific test class
    ./mvnw -Dtest=ClassNameTest test
  3. Generate JDK toolchains for integration tests

    master

    Before running integration tests that fork a JVM, you must generate the JDK toolchains file using the maven-toolchains-plugin.

    <mvnw> org.apache.maven.plugins:maven-toolchains-plugin:3.2.0:generate-jdk-toolchains-xml -Dtoolchain.file=src/it/toolchains.xml
  4. Maintain site and dependencies

    master

    Use the following commands for site generation and dependency management. Note that versions:* goals modify pom.xml in place; always review diffs to ensure compatibility with Java 8, Maven Plugin API, and Groovy requirements.

    Site Management

    TaskCommand
    Generate and stage the site<mvnw> clean site site:stage
    Generate and stage the site without tests<mvnw> -Dmaven.test.skip=true -DskipITs clean site site:stage
    Deploy the site<mvnw> clean site-deploy

    Dependency and Wrapper Maintenance

    TaskCommand
    Update the Maven Wrapper<mvnw> wrapper:wrapper -Dmaven=[Desired Maven version]
    Show available dependency, property, and plugin updates<mvnw> versions:display-dependency-updates versions:display-property-updates versions:display-plugin-updates
    Update all dependency and plugin versions<mvnw> versions:use-latest-versions -DprocessDependencies=true -DprocessPlugins=true -DprocessPluginDependencies=true -DprocessParent=true
    Update dependency and plugin versions held in properties<mvnw> versions:update-properties -DprocessDependencies=true -DprocessPlugins=true
    Show runtime dependencies<mvnw> dependency:tree -Dscope=runtime
    Show test dependencies<mvnw> dependency:tree -Dscope=test
    Show compile dependencies<mvnw> dependency:tree -Dscope=compile
  5. Package and publish artifacts

    master

    Use these commands to package, sign, and deploy the plugin.

    TaskCommand
    Package and sign<mvnw> -Dmaven.test.skip=true clean verify
    Deploy a tested snapshot<mvnw> -Dmaven.test.skip=true -Dinvoker.skip=true clean deploy
    Deploy a new snapshot<mvnw> clean deploy
  6. Perform a plugin release

    master

    Follow these steps to release the plugin. You can perform a dry run by adding -DdryRun=true to the release commands.

    1. Ensure gpg-agent is running.
    2. Verify signing capability:
      • Linux/Cmd: echo "test" | gpg --clearsign
      • PowerShell: Write-Host "test" | gpg --clearsign
    3. Run <mvnw> clean release:prepare.
    4. Run <mvnw> release:perform.
    5. Verify the plugin with a test project and run publish.sh or publish.ps1.
    6. Complete administrative tasks: Fetch from origin, create the next GitHub version, update the Usage and Examples wiki pages, and update the Android example.
    7. Announce the release on gmavenplus@googlegroups.com, users@groovy.apache.org, the Groovy Community Slack, and Twitter/X with #GMavenPlus and #GroovyLang.
  7. Redeploy artifacts after a signing failure

    master

    If a release fails due to signing issues, follow these steps to manually deploy artifacts to the Central Portal.

    1. Start gpg-agent and verify signing.
    2. Ensure the Maven central server entry uses a Central Portal user token (OSSRH tokens are deprecated).
    3. Check out the prepare release commit and copy pom.xml to target/gmavenplus-plugin-<version>.pom.
    4. Deploy each artifact (POM, JAR, Sources, Javadoc) using gpg:sign-and-deploy-file to the following URL: https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2 Use -DrepositoryId=central.
    5. Since gpg:sign-and-deploy-file does not trigger the full Maven deploy lifecycle, you must manually upload the deployment to the Central Publisher Portal using curl to trigger automatic publication.

    Note: Replace <namespace> with your namespace from https://central.sonatype.com/publishing/namespaces. The bearer token is the Base64-encoded Central Portal token (username:password).

    # 1. Deploy the POM
    <mvnw> gpg:sign-and-deploy-file '-DpomFile=target/gmavenplus-plugin-<version>.pom' '-Dfile=target/gmavenplus-plugin-<version>.pom' '-Durl=https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2' '-DrepositoryId=central'
    
    # 2. Deploy the JAR
    <mvnw> gpg:sign-and-deploy-file '-DpomFile=target/gmavenplus-plugin-<version>.pom' '-Dfile=target/gmavenplus-plugin-<version>.jar' '-Durl=https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2' '-DrepositoryId=central'
    
    # 3. Upload to Central Portal to trigger automatic publication
    curl --request POST --header "Authorization: Bearer <base64(token-username:token-password)>" "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/<namespace>?publishing_type=automatic"