From 6eab0c275a4f2ec9df9ad6efe84d207b5b5c2043 Mon Sep 17 00:00:00 2001 From: Mijhael Samaniego <67170467+mijhaels@users.noreply.github.com> Date: Mon, 12 Oct 2026 19:48:24 -0300 Subject: [PATCH 1/3] build: publish to Maven Central as py.com.ith:tu-ruc-client Maven Central requires a verified namespace. org.ith maps to ith.org, which ITH does not own, so the groupId moves to py.com.ith (ith.com.py). Java packages stay org.ith.*. Add the vanniktech maven-publish plugin with sources, Javadoc and PGP signatures, a complete POM, an MIT LICENSE, and a CI job that publishes tags matching the project version after the Java 17/21/25 matrix passes. Signing is only required when publishing to Maven Central. Drop gradle.properties, which only held placeholder GitHub Packages credentials. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 26 +++++++++++++++++++ CHANGELOG.md | 4 +++ CONTRIBUTING.md | 54 +++++++++++++++++++++++++++++++++++++++- LICENSE | 21 ++++++++++++++++ README.md | 37 ++++++++++++++------------- build.gradle | 53 ++++++++++++++++++++++++++++++++++++++- gradle.properties | 2 -- 7 files changed, 176 insertions(+), 21 deletions(-) create mode 100644 LICENSE delete mode 100644 gradle.properties diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 391dcca..b820629 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,3 +22,29 @@ jobs: cache: gradle - name: Check formatting, lint, build and test run: ./gradlew --no-daemon clean build -PjavaVersion=${{ matrix.java }} + + publish: + if: startsWith(github.ref, 'refs/tags/') + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-java@v6 + with: + distribution: temurin + java-version: "25" + cache: gradle + - name: Check release version + run: | + version=$(./gradlew --no-daemon -q properties --property version | sed -n 's/^version: //p') + if [ "$GITHUB_REF_NAME" != "$version" ]; then + echo "Tag $GITHUB_REF_NAME does not match project version $version" >&2 + exit 1 + fi + - name: Publish and release to Maven Central + run: ./gradlew --no-daemon publishAndReleaseToMavenCentral + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} diff --git a/CHANGELOG.md b/CHANGELOG.md index db442c3..44f6ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.1.0 — Sin publicar +- Publicación en Maven Central como `py.com.ith:tu-ruc-client`, con JAR de + fuentes, Javadoc y firmas PGP. El `groupId` cambia de `org.ith` a `py.com.ith`, + el dominio de ITH; los paquetes Java `org.ith.*` no cambian. +- Licencia MIT. - Compatibilidad verificada con Java 17, 21 y 25; JDK 25 para compilar por defecto y bytecode Java 17 para consumidores. - Gradle 9.8.1 con wrapper regenerado y SHA-256 de distribución verificado. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6954781..3d049cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,26 @@ puedes añadir `-PjavaVersion=17` o `-PjavaVersion=21` a los comandos anteriores Las herramientas de calidad son dependencias del build y no se publican como dependencias del cliente. +## Probar desde otro proyecto + +Para probar cambios sin publicar, clona este repositorio junto al proyecto +consumidor y agrega a su `settings.gradle`: + +```groovy +includeBuild("../tu-ruc-java-client") +``` + +Gradle sustituye `py.com.ith:tu-ruc-client` por el checkout local. Con la +configuración por defecto necesitas JDK 25 instalado. + +Para revisar los artefactos que se publicarían, sin firmarlos: + +```bash +./gradlew publishToMavenLocal +``` + +Quedan en `~/.m2/repository/py/com/ith/tu-ruc-client/`. + ## Integración continua CI ejecuta `./gradlew clean build` con Java 17, 21 y 25 y falla si alguna @@ -55,4 +75,36 @@ transitivos entre la compilación del consumidor y la ejecución. La conversión JSON usa el módulo oficial `fastjson2-extension`, que incluye el [conversor para Retrofit](https://github.com/alibaba/fastjson2/blob/2.0.65/extension/src/main/java/com/alibaba/fastjson2/support/retrofit/Retrofit2ConverterFactory.java). -Registra los cambios de cada versión en [CHANGELOG.md](CHANGELOG.md). +## Publicación + +La biblioteca se publica en [Maven Central](https://central.sonatype.com/) con el +plugin [`com.vanniktech.maven.publish`](https://vanniktech.github.io/gradle-maven-publish-plugin/central/). +Maven Central rechaza artefactos sin firmar, por eso la publicación exige la +clave PGP. + +Para publicar: + +1. Sube `version` en `build.gradle` y registra los cambios en + [CHANGELOG.md](CHANGELOG.md). +2. Crea y sube un tag con la misma versión, sin `v`: + + ```bash + git tag -a 0.1.0 -m "Tu RUC Java Client 0.1.0" + git push origin 0.1.0 + ``` + +CI ejecuta las comprobaciones con Java 17, 21 y 25, verifica que el tag coincida +con la versión y publica en Maven Central. Una versión publicada no se puede +borrar ni reemplazar. + +El workflow usa estos secretos del repositorio: + +| Secreto | Contenido | +| ------------------------ | ------------------------------------------------------------ | +| `MAVEN_CENTRAL_USERNAME` | Usuario del token de Central Portal con acceso a `py.com.ith` | +| `MAVEN_CENTRAL_PASSWORD` | Contraseña de ese token | +| `SIGNING_KEY` | Clave privada PGP exportada en ASCII (`gpg --armor --export-secret-keys`) | +| `SIGNING_KEY_PASSWORD` | Frase de la clave PGP | + +La clave pública debe estar en un servidor de claves que Maven Central consulte, +como `keys.openpgp.org` o `keyserver.ubuntu.com`. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8edec86 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 ITH + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index c399751..08bfe97 100644 --- a/README.md +++ b/README.md @@ -9,30 +9,25 @@ Java 17 o superior. ## Instalación -La biblioteca todavía no se publica en un repositorio Maven. Para usarla desde -otro proyecto Gradle, clona este repositorio junto a tu proyecto y agrega a su -`settings.gradle`: +La biblioteca se publica en Maven Central como `py.com.ith:tu-ruc-client`. -```groovy -includeBuild("../tu-ruc-java-client") -``` - -Y a su `build.gradle`: +Gradle: ```groovy -repositories { - mavenCentral() -} - dependencies { - implementation("org.ith:tu-ruc-client:0.1.0") + implementation("py.com.ith:tu-ruc-client:0.1.0") } ``` -Gradle compila la biblioteca y resuelve sus dependencias desde Maven Central. -Para compilarla así necesitas JDK 25 instalado, aunque el resultado funciona -desde Java 17. Si usas el JAR de `build/libs/`, agrega tú sus dependencias: -el JAR no las incluye. +Maven: + +```xml + + py.com.ith + tu-ruc-client + 0.1.0 + +``` ## Uso @@ -122,10 +117,18 @@ si tu proyecto lo usa, decláralo por tu cuenta. Las dependencias transitivas pasan a Retrofit 3.0.0 y OkHttp 5.5.0. +Las coordenadas Maven pasan de `org.ith:tu-ruc-client` a +`py.com.ith:tu-ruc-client`. Los paquetes Java no cambian: los imports siguen +siendo `org.ith.client` y `org.ith.model`. + ## Cambios Consulta [CHANGELOG.md](CHANGELOG.md) para conocer los cambios de cada versión. +## Licencia + +[MIT](LICENSE). + ## Contribuciones Para compilar, ejecutar las pruebas y conocer las comprobaciones de calidad, diff --git a/build.gradle b/build.gradle index f0e682b..f4d7378 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,14 @@ +import com.vanniktech.maven.publish.JavaLibrary +import com.vanniktech.maven.publish.JavadocJar + plugins { id("java-library") id("pmd") id("com.diffplug.spotless") version "8.10.4" + id("com.vanniktech.maven.publish") version "0.37.0" } -group = "org.ith" +group = "py.com.ith" version = "0.1.0" java { @@ -44,6 +48,11 @@ tasks.test { useJUnitPlatform() } +tasks.withType(Javadoc).configureEach { + options.encoding = "UTF-8" + options.addBooleanOption("Xdoclint:all,-missing", true) +} + spotless { java { palantirJavaFormat("2.102.0") @@ -60,3 +69,45 @@ pmd { ruleSetFiles = files("config/pmd/ruleset.xml") consoleOutput = true } + +mavenPublishing { + publishToMavenCentral() + signAllPublications() + coordinates(project.group.toString(), "tu-ruc-client", project.version.toString()) + configure(new JavaLibrary(new JavadocJar.Javadoc(), true)) + + pom { + name = "Tu RUC Java Client" + description = "Cliente Java para consultar y buscar contribuyentes en la API de Tu RUC." + inceptionYear = "2023" + url = "https://github.com/ithdev/tu-ruc-java-client" + licenses { + license { + name = "MIT License" + url = "https://opensource.org/license/mit" + distribution = "repo" + } + } + developers { + developer { + id = "ithdev" + name = "ITH" + url = "https://ith.com.py" + } + } + scm { + url = "https://github.com/ithdev/tu-ruc-java-client" + connection = "scm:git:https://github.com/ithdev/tu-ruc-java-client.git" + developerConnection = "scm:git:ssh://git@github.com/ithdev/tu-ruc-java-client.git" + } + } +} + +// Maven Central rechaza artefactos sin firmar; para publicar en Maven local no hace falta firmar. +signing { + required = { + gradle.taskGraph.allTasks.any { + it.name.contains("MavenCentral") + } + } +} diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 5b15902..0000000 --- a/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -gpr.user=ithdev -gpr.token=secret_token From 71138a3d68c0bf53757344f2c7116505461d9cec Mon Sep 17 00:00:00 2001 From: Mijhael Samaniego <67170467+mijhaels@users.noreply.github.com> Date: Mon, 12 Oct 2026 20:12:00 -0300 Subject: [PATCH 2/3] docs: use ITH E.A.S. as copyright holder Co-Authored-By: Claude Opus 5.5 --- LICENSE | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 8edec86..cb9619f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 ITH +Copyright (c) 2023 ITH E.A.S. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.gradle b/build.gradle index f4d7378..f043fd2 100644 --- a/build.gradle +++ b/build.gradle @@ -91,7 +91,7 @@ mavenPublishing { developers { developer { id = "ithdev" - name = "ITH" + name = "ITH E.A.S." url = "https://ith.com.py" } } From f550b479d9a7a76dbcffe3a64c210dde0f98fa75 Mon Sep 17 00:00:00 2001 From: Mijhael Samaniego <67170467+mijhaels@users.noreply.github.com> Date: Mon, 12 Oct 2026 20:17:01 -0300 Subject: [PATCH 3/3] docs: date the 0.1.0 changelog entry Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b705544..7ab726b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.1.0 — Sin publicar +## 0.1.0 — 2026-10-12 - Publicación en Maven Central como `py.com.ith:tu-ruc-client`, con JAR de fuentes, Javadoc y firmas PGP. El `groupId` cambia de `org.ith` a `py.com.ith`,