Setup Java Library

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Generate (or update) pom.xml at the repository root for a Java library from an explicit, genericized example template, and scaffold the standard Maven source layout for the library’s base package.

Purpose

iru-setup-java-library bootstraps a new Java/Maven library’s pom.xml from a house template embedded in the skill itself — the same test dependencies (junit-jupiter, junit-platform-launcher, mockito-core, mockito-junit-jupiter), the same build-extras profile, and the same build/reporting plugins, with only the project-identity fields filled in per repository. Whether the repository is open source, whether it publishes to Maven Central (gating the sign profile and the central-publishing-maven-plugin), and whether to wire up a SonarQube/SonarCloud scan (gating the sonar.* properties and the sonar-maven-plugin) are also resolved — asked interactively, deriving publish/sonar recommendations from the open-source answer (and, for Sonar, the repository’s visibility), or pre-supplied via args.

The skill announces whether it is creating pom.xml from scratch or updating an existing setup. If a pom.xml already exists it warns, names any contradiction between the file and this run’s answers, and asks Update (merge the template in, keeping custom dependencies/plugins), Keep as is, Replace from the example, or Stop — unless on-existing in args decides. Existing source folders are always left untouched. It also creates the src/main/java/<package>, src/main/resources/<package>, and src/test/java/<package> folders for the library’s base package.

Purpose group

Plugin

Shipped by the iru-java plugin of the ai-catalog marketplace (install with /plugin install iru-java@ai-catalog; see Plugins).

Invocation

/iru-setup-java-library

Inputs

Argument Required Description Default

args

No

Pre-resolved parameters passed by an orchestrating skill (e.g. Setup Java Library Repository) as newline-separated key: value lines — groupId, artifactId, package, developer-name, developer-email, organization-url, license, java-version, open-source, visibility, ci, publish, sonar (+ sonar-organization/sonar-project-key/sonar-host-url), on-existing — other keys (e.g. mode, ci-tests, pages) are ignored — parsed in Step 0 so this skill doesn’t ask about any field already resolved this way.

None — if absent or unrecognized, every field is asked interactively.

open-source

No (unless resolved via args)

Whether the repository is open source (yes/no), asked first via AskUserQuestion — its answer sets the recommended defaults offered for publish and sonar.

None — user must choose

publish

No (unless resolved via args)

Whether the generated pom.xml wires up Maven Central publishing (yes/no), gating the sign profile and the central-publishing-maven-plugin plugin entry.

yes recommended when open source, otherwise no recommended

visibility

No

public, private, or internal (behaves like private). Only used to pick the recommended Sonar answer; if absent and sonar must be asked, resolved via gh repo view --json visibility, otherwise asked (Public/Private). Flags a contradiction if open source but private/internal.

Detected or asked

ci

No

yes or no. With ci: no, nothing would send Sonar reports automatically, so the Sonar question recommends none and the report notes analysis only runs via a manual mvn sonar:sonar. This skill never asks it.

yes when absent

on-existing

No

ask, keep, update, or replace: how an existing pom.xml is treated without asking (the warning is still printed). Scripted runs only.

ask

sonar

No (unless resolved via args)

Whether to wire up a SonarQube/SonarCloud scan via the sonar-maven-plugin (cloud/self-hosted/none), gating the four sonar.* properties and the plugin entry.

cloud recommended when open source and public, otherwise none recommended (SonarCloud is free only for public projects)

sonar-organization / sonar-project-key / sonar-host-url

Only when sonar is cloud or self-hosted

sonar.organization/sonar.projectKey/sonar.host.url values. Defaulted from the parsed git owner/repo (<owner>-github, <owner>_<repo>) and https://sonarcloud.io for cloud; asked directly (no default for sonar.host.url) for self-hosted.

See defaults above

groupId

Yes (unless supplied via args)

Maven groupId, e.g. com.example.

None

artifactId

Yes (unless supplied via args)

Maven artifactId, e.g. my-library.

None

version

No

Project version.

1.0.0-SNAPSHOT

Java version

No

Java language level the library targets, written to maven.compiler.source/maven.compiler.target.

21

Library package

Yes (unless supplied via args)

Base Java package for the library’s main source (need not equal groupId), used for the src/main/java/<package> layout and the build-info write path.

None

Developer name / email / organizationUrl

Yes (unless supplied via args)

Populates the <developers> block.

None

License

Yes (unless supplied via args)

Resolved via AskUserQuestion: Apache License 2.0, MIT License, No license, or Other (asked for a display name and URL directly).

None — user must choose

Outputs

  • pom.xml at the repository root: created fresh, updated in place (merging the template into the existing file, shown as a diff for approval before writing), replaced entirely, or left as is, depending on the Step 1 choice.

    • Conditional blocks: the sign profile and the central-publishing-maven-plugin plugin entry are included only when publish: yes (the build-extras profile is always kept, regardless of publish); the four sonar.* properties and the sonar-maven-plugin plugin entry are included only when sonar is cloud or self-hosted, omitted entirely when sonar: none.

  • src/main/java/<package>, src/main/resources/<package>, and src/test/java/<package> created if not already present (empty directories won’t show up in git status until they contain a file).

  • A report starting with whether the run created from scratch or updated, and the action on pom.xml (created, updated, replaced, kept as is, or stopped; user answer or on-existing), then the resolved groupId/artifactId/version, the license chosen (or "none"), the inferred repository information, and which source folders were created versus already present (existing ones reported as kept as is), each mismatch between a kept pom.xml and this run’s values, a note that no CI step sends Sonar reports if ci: no with Sonar configured, plus an explicit statement of which conditional blocks were included versus omitted (open-source, publish, sonar) and why — plus an explicit warning to review the generated pom.xml before building or committing.

Execution flow

flowchart TD A[Start /iru-setup-java-library] --> B{"Step 0: args supplied?"} B -- yes --> C["Parse key: value pairs from args\n(incl. visibility, ci, on-existing)"] B -- no --> D[Treat every field as unset] C --> E{"Step 1: pom.xml already exists?"} D --> E E -- no --> E2["Announce: creating from scratch"] E -- yes --> F["Announce: updating existing setup; warn;\nread pom.xml and name contradictions"] F --> F2{"on-existing set?"} F2 -- yes --> F3["Apply keep/update/replace\nwithout asking"] F2 -- no --> F4["AskUserQuestion:\nUpdate / Keep as is / Replace / Stop"] F3 --> FC F4 --> FC{"Choice"} FC -- stop --> G[Report pom.xml untouched; end] FC -- keep --> M["Step 7: Scaffold source folders\n(package from args or existing layout)"] FC -- update or replace --> H["Use existing pom.xml values\nas defaults for unresolved fields"] E2 --> I H --> I["Step 2: Collect remaining inputs\n(groupId, artifactId, version, package,\ndeveloper info, license)"] I --> I2["Step 2: Ask open-source first,\nresolve visibility, derive publish/sonar defaults;\nresolve publish and sonar"] I2 --> J["Step 3: Infer repository info\n(owner/repo/host, description,\ninception year) from git/gh"] J --> K["Step 4-5: Fill pom.xml template;\nomit sign profile &amp; central-publishing\nplugin if publish: no, omit sonar.*\nproperties &amp; plugin if sonar: none"] K --> L["Step 6: Write pom.xml\n(new/replace: write; update: merge,\nshow diff, write on approval)"] L --> M M --> N["Step 8: Report action taken + warn:\nreview before building"]

Dependencies

Invokes

None — iru-setup-java-library is a leaf skill; it does not call any other skill in this catalog.

Invoked by

  • Setup Java Library Repository — Step 3 runs iru-setup-java-library first (always, even for an existing repository), passing the pre-resolved groupId, artifactId, package, developer name/email/organizationUrl, license, Java version, open-source/publish/sonar, visibility, ci, and (when supplied) on-existing via args as key: value lines so this skill’s own Step 2 questions are skipped and the user isn’t asked twice.

None.

Source

SKILL.md on GitHub — the file this page was generated from.