### Install via buildscript
Source: https://kordamp.org/pomchecker/pomchecker-gradle-plugin/index.html
Adds the plugin to the buildscript classpath and applies it.
```groovy
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath 'org.kordamp.gradle:pomchecker-gradle-plugin:1.11.0'
}
}
apply plugin: 'org.kordamp.gradle.pomchecker'
```
--------------------------------
### Install via plugins DSL
Source: https://kordamp.org/pomchecker/pomchecker-gradle-plugin/index.html
Applies the plugin using the plugins block.
```groovy
plugins {
id 'org.kordamp.gradle.pomchecker' version '1.11.0'
}
```
--------------------------------
### main(String[] args)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/Main.html
Static entry point for the CLI application. Accepts command-line arguments and invokes the run method.
```APIDOC
## main(String[] args)
### Description
Static entry point for the CLI application. Accepts command-line arguments and invokes the run method.
### Method
main
### Signature
`public static void main(String[] args)`
### Parameters
- **args** (String[]) - Required - Command-line arguments.
### Returns
void
```
--------------------------------
### Main()
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/org/kordamp/maven/checker/cli/Main.html
Constructor for the Main class.
```APIDOC
## Main()
### Description
Constructor for the Main class.
### Method
Constructor
### Signature
`public Main()`
```
--------------------------------
### Configure pomchecker:check-maven-central in a Maven profile
Source: https://kordamp.org/pomchecker/pomchecker-maven-plugin/index.html
Configure the plugin inside a release profile to avoid build failures during development, as release and strict are true by default. This example defines an execution with the goal check-maven-central, using plugin version 1.11.0.
```xml
[...]
release
org.kordamp.maven
pomchecker-maven-plugin
1.11.0
check-release
check-maven-central
[...]
```
--------------------------------
### Initialize RepositorySystem
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Configures a new RepositorySystem using a DefaultServiceLocator with basic connector and transporter factories.
```java
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
return locator.getService(RepositorySystem.class);
}
```
--------------------------------
### Initialize RepositorySystem
Source: https://kordamp.org/pomchecker/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Configures a new RepositorySystem using MavenRepositorySystemUtils with basic connector and transporter factories.
```java
private static RepositorySystem newRepositorySystem() {
DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
locator.addService(TransporterFactory.class, FileTransporterFactory.class);
locator.addService(TransporterFactory.class, HttpTransporterFactory.class);
return locator.getService(RepositorySystem.class);
}
```
--------------------------------
### run()
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/Main.html
Instance method to run the CLI. Implements Runnable interface.
```APIDOC
## run()
### Description
Instance method to run the CLI. Implements Runnable interface.
### Method
run
### Signature
`public void run()`
### Returns
void
```
--------------------------------
### Configuration()
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/MavenCentralChecker.Configuration.html
Constructor for the Configuration class.
```APIDOC
## Configuration()
### Description
Creates a new instance of MavenCentralChecker.Configuration.
### Method
Constructor
### Signature
`public Configuration()`
```
--------------------------------
### Create DefaultRepositorySystemSession
Source: https://kordamp.org/pomchecker/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Creates a session and configures the local repository manager based on the provided RepositorySystem.
```java
private static DefaultRepositorySystemSession createDefaultRepositorySystemSession(RepositorySystem system) {
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
LocalRepository localRepository = new LocalRepository(findLocalRepository());
session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepository));
return session;
}
```
--------------------------------
### getVersion()
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/org/kordamp/maven/checker/cli/Versions.html
Returns the version information for the CLI tool as an array of strings. This method implements the picocli.CommandLine.IVersionProvider interface and may throw an Exception.
```APIDOC
## getVersion()
### Description
Returns the version information for the CLI tool as an array of strings. This method implements the picocli.CommandLine.IVersionProvider interface and may throw an Exception.
### Method
Instance method
### Source
Class: org.kordamp.maven.checker.cli.Versions
Since: 1.1.0
### Return Value
- **String[]** - An array of version strings
### Throws
- **Exception** - May throw an exception during version retrieval
```
--------------------------------
### run(String... args)
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/org/kordamp/maven/checker/cli/Main.html
Runs the application with the given arguments.
```APIDOC
## run(String... args)
### Description
Runs the application with the given arguments.
### Method
Static method
### Signature
`public static int run(String... args)`
### Parameters
- **args** (String...) - Required - command-line arguments
### Returns
- `int` - exit code
```
--------------------------------
### run()
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/org/kordamp/maven/checker/cli/Main.html
Executes the main logic of the application.
```APIDOC
## run()
### Description
Executes the main logic of the application.
### Method
Instance method
### Signature
`public void run()`
```
--------------------------------
### Constructor MavenLoggerAdapter(Log delegate)
Source: https://kordamp.org/pomchecker/pomchecker-core/apidocs/org/kordamp/maven/checker/MavenLoggerAdapter.html
Creates a MavenLoggerAdapter instance with the given Maven Log delegate.
```APIDOC
## Constructor: MavenLoggerAdapter(Log delegate)
### Description
Constructs a new MavenLoggerAdapter with the specified Maven Log delegate.
### Signature
public MavenLoggerAdapter(org.apache.maven.plugin.logging.Log delegate)
### Parameters
- delegate (org.apache.maven.plugin.logging.Log) - Required - The Maven Log delegate to adapt.
```
--------------------------------
### createMavenProject(File pomFile)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/internal/PomParser.html
Creates a MavenProject from the given POM file. This method is static and returns an org.apache.maven.project.MavenProject instance.
```APIDOC
## createMavenProject(File pomFile)
### Description
Creates a MavenProject from the given POM file.
### Method
static
### Signature
public static org.apache.maven.project.MavenProject createMavenProject(File pomFile)
### Parameters
- **pomFile** (File) - Required - The POM file to parse.
### Returns
- **org.apache.maven.project.MavenProject** - The created MavenProject.
### Example
```java
File pomFile = new File("pom.xml");
MavenProject project = PomParser.createMavenProject(pomFile);
```
```
--------------------------------
### Configuration()
Source: https://kordamp.org/pomchecker/pomchecker-core/apidocs/org/kordamp/maven/checker/MavenCentralChecker.Configuration.html
Creates a new instance of the MavenCentralChecker.Configuration class.
```APIDOC
## Configuration()
### Description
Creates a new instance of the `MavenCentralChecker.Configuration` class.
### Method
Constructor
### Signature
`public Configuration()`
### Parameters
None
### Returns
A new `MavenCentralChecker.Configuration` instance.
```
--------------------------------
### pomchecker --help output
Source: https://kordamp.org/pomchecker/pomchecker-cli/index.html
Shows the usage and options for the main pomchecker command, including the -D system property option and the available subcommands check-bom and check-maven-central.
```bash
$ pomchecker --help
Usage: pomchecker [-hV] [COMMAND]
Usage: pomchecker [-hV] [-D=]... [COMMAND]
pomchecker
-D= Sets a System property. Repeatable.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
check-bom Checks if a POM file is a minimal BOM file
check-maven-central Checks if a POM complies with the rules for uploading to
Maven Central
```
--------------------------------
### pomchecker:help
Source: https://kordamp.org/pomchecker/pomchecker-maven-plugin/help-mojo.html
Displays help information for the pomchecker-maven-plugin. Use the `detail` parameter to show all settable properties for each goal, and the `goal` parameter to show help for a specific goal.
```APIDOC
## pomchecker:help
### Description
Displays help information for the pomchecker-maven-plugin. Use the `detail` parameter to show all settable properties for each goal, and the `goal` parameter to show help for a specific goal.
### Method
Maven Plugin Goal
### Goal
`pomchecker:help`
### Parameters
#### Optional Parameters
- **detail** (boolean) - Optional - If `true`, display all settable properties for each goal. Default: `false`. User property: `detail`.
- **goal** (String) - Optional - The name of the goal for which to show help. If unspecified, all goals will be displayed. User property: `goal`.
- **indentSize** (int) - Optional - The number of spaces per indentation level, should be positive. Default: `2`. User property: `indentSize`.
- **lineLength** (int) - Optional - The maximum length of a display line, should be positive. Default: `80`. User property: `lineLength`.
### Usage Example
```
mvn pomchecker:help -Ddetail=true -Dgoal=
```
### Response
Displays help information in the console, including goal descriptions and parameter details when `detail` is `true`.
```
--------------------------------
### run(String... args)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/Main.html
Static method to run the CLI with the given arguments. Returns an exit code indicating success or failure.
```APIDOC
## run(String... args)
### Description
Static method to run the CLI with the given arguments. Returns an exit code indicating success or failure.
### Method
run
### Signature
`public static int run(String... args)`
### Parameters
- **args** (String...) - Required - Command-line arguments.
### Returns
int - Exit code.
```
--------------------------------
### SimpleLoggerAdapter(PrintWriter out, SimpleLoggerAdapter.Level level)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/internal/SimpleLoggerAdapter.html
Constructs a SimpleLoggerAdapter with the specified PrintWriter and logging level.
```APIDOC
## SimpleLoggerAdapter(PrintWriter out, SimpleLoggerAdapter.Level level)
### Description
Constructs a SimpleLoggerAdapter with the specified PrintWriter and logging level.
### Constructor
`SimpleLoggerAdapter(PrintWriter out, SimpleLoggerAdapter.Level level)`
### Parameters
- **out** (PrintWriter) - Required - The PrintWriter to which log messages will be written.
- **level** (SimpleLoggerAdapter.Level) - Required - The logging level that determines which messages are logged.
```
--------------------------------
### pomchecker check-maven-central --help output
Source: https://kordamp.org/pomchecker/pomchecker-cli/index.html
Shows the usage and options for the check-maven-central subcommand, including the --[no-]release flag to check for -SNAPSHOT versions and the --[no-]strict flag to check for repositories and pluginRepositories.
```bash
$ pomchecker check-maven-central --help
Usage: pomchecker check-maven-central [-dhiqVw] [--[no-]fail-on-error] [--[no-]
fail-on-warning] [--[no-]release] [--[no-]
strict] --file=
[-D=]...
Checks if a POM complies with the rules for uploading to Maven Central
-d, --debug Set log level to debug.
-D= Sets a System property. Repeatable.
--[no-]fail-on-error Fails the build on error.
--[no-]fail-on-warning Fails the build on warning.
--file= The POM file to check. Defaults to pom.xml.
-h, --help Show this help message and exit.
-i, --info Set log level to info.
-q, --quiet Log errors only.
--[no-]release Checks if version is -SNAPSHOT.
--[no-]strict Checks if and
are present.
-V, --version Print version information and exit.
-w, --warn Set log level to warn.
```
--------------------------------
### BomChecker.Configuration()
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/BomChecker.Configuration.html
Constructs a new BomChecker.Configuration instance.
```APIDOC
## BomChecker.Configuration()
### Description
Constructs a new BomChecker.Configuration instance.
### Method
Constructor
### Signature
`public Configuration()`
```
--------------------------------
### SimpleLoggerAdapter(PrintWriter out)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/internal/SimpleLoggerAdapter.html
Constructs a SimpleLoggerAdapter with the specified PrintWriter for output.
```APIDOC
## SimpleLoggerAdapter(PrintWriter out)
### Description
Constructs a SimpleLoggerAdapter with the specified PrintWriter for output.
### Constructor
`SimpleLoggerAdapter(PrintWriter out)`
### Parameters
- **out** (PrintWriter) - Required - The PrintWriter to which log messages will be written.
```
--------------------------------
### pomchecker check-bom --help output
Source: https://kordamp.org/pomchecker/pomchecker-cli/index.html
Shows the usage and options for the check-bom subcommand, including the --file option (defaults to pom.xml) and the --[no-]fail-on-error flag.
```bash
$ pomchecker check-bom --help
Usage: pomchecker check-bom [-dhiqVw] [--[no-]fail-on-error] --file=
[-D=]...
Checks if a POM file is a minimal BOM file
-d, --debug Set log level to debug.
-D= Sets a System property. Repeatable.
--[no-]fail-on-error Fails the build on error.
--file= The POM file to check. Defaults to pom.xml.
-h, --help Show this help message and exit.
-i, --info Set log level to info.
-q, --quiet Log errors only.
-V, --version Print version information and exit.
-w, --warn Set log level to warn.
```
--------------------------------
### Apache Buildr dependency
Source: https://kordamp.org/pomchecker/pomchecker-cli/dependency-info.html
Use this string format for your Buildr project configuration.
```text
'org.kordamp.maven:pomchecker-cli:jar:1.11.0'
```
--------------------------------
### withRelease(boolean release)
Source: https://kordamp.org/pomchecker/pomchecker-core/apidocs/org/kordamp/maven/checker/MavenCentralChecker.Configuration.html
Sets the `release` flag and returns the configuration instance for chaining.
```APIDOC
## withRelease(boolean release)
### Description
Sets the value for `release`. If `true`, checks that the version is not a `-SNAPSHOT`.
### Method
Setter
### Signature
`public MavenCentralChecker.Configuration withRelease(boolean release)`
### Parameters
- **release** (boolean) - Required - if `true`, checks that version is not `-SNAPSHOT`.
### Returns
The current `MavenCentralChecker.Configuration` instance for method chaining.
```
--------------------------------
### DSL configuration
Source: https://kordamp.org/pomchecker/pomchecker-gradle-plugin/index.html
Shows the available DSL properties for the pomchecker extension.
```groovy
pomchecker {
enabled
bom
release
strict
failOnError
failOnWarning
}
```
--------------------------------
### detectOsProperties()
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/internal/PomParser.html
Detects OS properties and returns them as an immutable map of strings. This method is static and returns a com.google.common.collect.ImmutableMap.
```APIDOC
## detectOsProperties()
### Description
Detects OS properties and returns them as an immutable map.
### Method
static
### Signature
public static com.google.common.collect.ImmutableMap detectOsProperties()
### Returns
- **com.google.common.collect.ImmutableMap** - A map of OS properties.
### Example
```java
ImmutableMap osProps = PomParser.detectOsProperties();
```
```
--------------------------------
### Detect OS Properties
Source: https://kordamp.org/pomchecker/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Returns an ImmutableMap containing normalized OS name, architecture, and classifier strings.
```java
public static ImmutableMap detectOsProperties() {
return ImmutableMap.of(
"os.detected.name",
osDetectedName(),
"os.detected.arch",
osDetectedArch(),
"os.detected.classifier",
osDetectedName() + "-" + osDetectedArch());
}
```
--------------------------------
### Normalize OS Name and Architecture
Source: https://kordamp.org/pomchecker/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Helper methods to normalize system properties for OS name and architecture into standard identifiers.
```java
private static String osDetectedName() {
String osNameNormalized =
LOWER_ALPHA_NUMERIC.retainFrom(System.getProperty("os.name").toLowerCase(Locale.ENGLISH));
if (osNameNormalized.startsWith("macosx") || osNameNormalized.startsWith("osx")) {
return "osx";
} else if (osNameNormalized.startsWith("windows")) {
return "windows";
}
// Since we only load the dependency graph, not actually use the
// dependency, it doesn't matter a great deal which one we pick.
return "linux";
}
```
```java
private static String osDetectedArch() {
String osArchNormalized =
LOWER_ALPHA_NUMERIC.retainFrom(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH));
switch (osArchNormalized) {
case "x8664":
case "amd64":
case "ia32e":
case "em64t":
case "x64":
return "x86_64";
default:
return "x86_32";
}
}
```
--------------------------------
### Invoke pomchecker:check-maven-central from the command line
Source: https://kordamp.org/pomchecker/pomchecker-maven-plugin/index.html
Run the PomChecker plugin's check-maven-central goal directly from the command line. The checker.release and checker.strict properties can be used for additional parameters, and failOnError/failOnWarning can be set via checker.fail.on.error and checker.fail.on.warning user properties.
```bash
$ mvn org.kordamp.maven:pomchecker-maven-plugin:1.11.0:check-maven-central
```
--------------------------------
### run(PrintWriter out, PrintWriter err, String... args)
Source: https://kordamp.org/pomchecker/apidocs/org/kordamp/maven/checker/cli/Main.html
Static method to run the CLI with specified output and error writers. Returns an exit code indicating success or failure.
```APIDOC
## run(PrintWriter out, PrintWriter err, String... args)
### Description
Static method to run the CLI with specified output and error writers. Returns an exit code indicating success or failure.
### Method
run
### Signature
`public static int run(PrintWriter out, PrintWriter err, String... args)`
### Parameters
- **out** (PrintWriter) - Required - Writer for standard output.
- **err** (PrintWriter) - Required - Writer for error output.
- **args** (String...) - Required - Command-line arguments.
### Returns
int - Exit code.
```
--------------------------------
### Web Browser Access URL for pomchecker-cli
Source: https://kordamp.org/pomchecker/pomchecker-cli/scm.html
URL for browsing the source repository in a web browser.
```text
git@github.com:kordamp/pomchecker.git/pomchecker-cli
```
--------------------------------
### getPlainVersion()
Source: https://kordamp.org/pomchecker/pomchecker-core/apidocs/org/kordamp/maven/checker/PomcheckerVersion.html
Returns the plain version string of the Pomchecker application.
```APIDOC
## getPlainVersion()
### Description
Returns the plain version string of the Pomchecker application.
### Method Signature
public static String getPlainVersion()
### Returns
- **String** - The plain version string.
```
--------------------------------
### PomParser.createMavenProject(File)
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/index-all.html
Creates a Maven project from a POM file. This static method is part of the PomParser class and is used to parse a POM file into a Maven project object.
```APIDOC
## PomParser.createMavenProject(File)
### Description
Creates a Maven project from a POM file. This static method is part of the PomParser class and is used to parse a POM file into a Maven project object.
### Method
createMavenProject
### Signature
`public static MavenProject createMavenProject(File pomFile)`
### Parameters
- **pomFile** (File) - Required - The POM file to parse.
### Returns
MavenProject - The parsed Maven project.
### Usage Example
```java
File pomFile = new File("pom.xml");
MavenProject project = PomParser.createMavenProject(pomFile);
```
```
--------------------------------
### Detect OS Properties
Source: https://kordamp.org/pomchecker/pomchecker-cli/apidocs/src-html/org/kordamp/maven/checker/cli/internal/PomParser.html
Detects operating system name, architecture, and classifier for dependency graph loading.
```java
public static ImmutableMap detectOsProperties() {
return ImmutableMap.of(
"os.detected.name",
osDetectedName(),
"os.detected.arch",
osDetectedArch(),
"os.detected.classifier",
osDetectedName() + "-" + osDetectedArch());
}
private static String osDetectedName() {
String osNameNormalized =
LOWER_ALPHA_NUMERIC.retainFrom(System.getProperty("os.name").toLowerCase(Locale.ENGLISH));
if (osNameNormalized.startsWith("macosx") || osNameNormalized.startsWith("osx")) {
return "osx";
} else if (osNameNormalized.startsWith("windows")) {
return "windows";
}
// Since we only load the dependency graph, not actually use the
// dependency, it doesn't matter a great deal which one we pick.
return "linux";
}
private static String osDetectedArch() {
String osArchNormalized =
LOWER_ALPHA_NUMERIC.retainFrom(System.getProperty("os.arch").toLowerCase(Locale.ENGLISH));
switch (osArchNormalized) {
case "x8664":
case "amd64":
case "ia32e":
case "em64t":
case "x64":
return "x86_64";
default:
return "x86_32";
}
}
```
--------------------------------
### Parameter documentation writer
Source: https://kordamp.org/pomchecker/apidocs/src-html/org/kordamp/maven/pomchecker_maven_plugin/HelpMojo.html
Formats and writes individual parameter details, including default values, to the output buffer.
```java
private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement )
throws MojoExecutionException
{
String parameterName = getValue( parameter, "name" );
String parameterDescription = getValue( parameter, "description" );
Element fieldConfigurationElement = null;
if ( configurationElement != null )
{
fieldConfigurationElement = (Element) findSingleChild( configurationElement, parameterName );
}
String parameterDefaultValue = "";
if ( fieldConfigurationElement != null && fieldConfigurationElement.hasAttribute( "default-value" ) )
{
parameterDefaultValue = " (Default: " + fieldConfigurationElement.getAttribute( "default-value" ) + ")";
}
```
--------------------------------
### Invoke pomchecker:check-bom from the command line
Source: https://kordamp.org/pomchecker/pomchecker-maven-plugin/index.html
Run the PomChecker plugin's check-bom goal manually using Maven, as recommended for minimal BOM files that cannot contain a element. Use the fully qualified plugin coordinates with version 1.11.0.
```bash
$ mvn org.kordamp.maven:pomchecker-maven-plugin:1.11.0:check-bom
```
--------------------------------
### Constructor: MavenEnforcerLoggerAdapter(EnforcerLogger)
Source: https://kordamp.org/pomchecker/pomchecker-enforcer-rules/apidocs/org/kordamp/maven/enforcer/checker/MavenEnforcerLoggerAdapter.html
Creates a new MavenEnforcerLoggerAdapter with the given delegate EnforcerLogger.
```APIDOC
## Constructor: MavenEnforcerLoggerAdapter
### Description
Creates a new MavenEnforcerLoggerAdapter with the given delegate EnforcerLogger.
### Signature
`public MavenEnforcerLoggerAdapter(org.apache.maven.enforcer.rule.api.EnforcerLogger delegate)`
### Parameters
- `delegate` (org.apache.maven.enforcer.rule.api.EnforcerLogger) - Required - The delegate logger to which all logging calls will be forwarded.
```
--------------------------------
### Browsable Source Repository URL
Source: https://kordamp.org/pomchecker/pomchecker-enforcer-rules/scm.html
The URL for accessing the source repository via a web browser.
```text
git@github.com:kordamp/pomchecker.git/pomchecker-enforcer-rules
```