Parent POM for open source projects.
This project provides a parent POM configuration for open source Maven projects. It includes common configurations, plugin management, and dependency management to standardize build processes across multiple projects.
To use this parent POM in your project, add the following to your pom.xml:
<parent>
<groupId>com.dataliquid</groupId>
<artifactId>parent-oss</artifactId>
<version>2.1.0</version>
</parent>- Standardized plugin configurations
- Common dependency management
- Build optimization settings
- Release management configuration
- Quality assurance tools integration
- Automatic code formatting with CI-aware profiles
This parent POM provides automatic code formatting using the formatter-maven-plugin with CI-aware profile activation.
The formatter profiles activate automatically based on the CI environment:
-
Local Development (CI environment variable not set):
- Profile
format-codeactivates automatically - Runs
formatter:formatduring the validate phase - Automatically formats code according to the configured style guide
- Profile
-
CI/CD Pipeline (CI=true):
- Profile
format-code-validationactivates automatically - Runs
formatter:validateduring the validate phase - Fails the build if code is not properly formatted
- Profile
The parent POM includes:
- Dependency:
com.dataliquid.guidelines:coding-conventionscontaining formatter styles - Default Styles:
- Java:
codestyles/default/java-formatter.xml - JavaScript:
codestyles/default/javascript-formatter.xml - JSON:
codestyles/default/json-formatter.properties - HTML:
codestyles/default/html-formatter.properties - CSS:
codestyles/default/css-formatter.properties
- Java:
- Line Ending: LF (Unix-style)
- Encoding: UTF-8
Child projects can override the formatter configuration while still using the styles from the parent's dependency:
<build>
<plugins>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<configuration>
<!-- Use alternative style from the classpath dependency -->
<configFile>codestyles/traditional/eclipse-codestyle.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>All styles are loaded from the classpath, so no local files are needed in your project.
To skip formatting completely, deactivate both profiles:
mvn clean validate -P!format-code,!format-code-validation- distribution-verifier-maven-plugin: Maven plugin for verifying distribution archives
- json-yaml-validator-maven-plugin: Maven plugin for validating JSON and YAML files against schemas
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.