-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having an uber pom for better build #9
Conversation
WalkthroughThis pull request introduces a comprehensive restructuring of the Pibify project's build configuration and module management. The changes include creating a parent POM file, updating module configurations, modifying the Dropwizard test environment, and adding Pibify annotations to the Product class. The modifications aim to standardize the project structure, improve build consistency, and enhance the configuration management across different test environments. Changes
Assessment against linked issues
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (5)
test-environments/dropwizard/test-dropwizard/pom.xml (2)
Line range hint
91-102
: Consolidate duplicate maven-compiler-plugin configurations.The maven-compiler-plugin is declared twice with different configurations. This can lead to confusion and potential conflicts.
Consolidate the configurations into a single declaration:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.13.0</version> <configuration> <source>8</source> <target>8</target> </configuration> <executions> <execution> <id>compile-generated-pibify-sources</id> <phase>prepare-package</phase> <goals> <goal>compile</goal> </goals> </execution> </executions> </plugin>Also applies to: 156-171
Use Dropwizard version 4.0.1 instead of 4.0.10
The specified version 4.0.10 appears to be a future version that hasn't been released yet. The latest stable version of Dropwizard is 4.0.1. Update the version in:
<dropwizard.version>
propertydropwizard-core
dependency version in thepibify-maven-plugin
configuration🔗 Analysis chain
Line range hint
37-37
: Verify Dropwizard version compatibility.The specified Dropwizard version
4.0.10
appears incorrect as it doesn't align with Dropwizard's version history (latest stable is 2.x).Run this script to check available Dropwizard versions:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check latest Dropwizard versions from Maven Central curl -s "https://search.maven.org/solrsearch/select?q=g:io.dropwizard+AND+a:dropwizard-core&rows=5&wt=json" | jq -r '.response.docs[].v' | sort -VLength of output: 153
Script:
#!/bin/bash # Find all pom.xml files and search for Dropwizard version references fd pom.xml --exec grep -l "dropwizard" {} \; | xargs cat # Search for Dropwizard imports in source files rg "import.*dropwizard" -A 2Length of output: 11246
test-environments/lombok/pom.xml (1)
Invalid jackson-databind version specified
The version 2.17.2 appears to be invalid as it's not available in Maven Central. The latest available version as of January 2025 is 2.18.2.
- Update
jackson-databind
version intest-environments/lombok/pom.xml
to use a valid version (e.g., 2.18.2)🔗 Analysis chain
Line range hint
106-110
: Verify jackson-databind version validity and security.The specified version 2.17.2 appears to be from the future relative to the current date (January 2025).
Run this script to check available versions and security advisories:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check Maven Central for latest jackson-databind version echo "Checking jackson-databind versions..." curl -s https://search.maven.org/solrsearch/select?q=g:%22com.fasterxml.jackson.core%22+AND+a:%22jackson-databind%22&rows=5&wt=json | jq '.response.docs[].v' # Check for security advisories gh api graphql -f query=' { securityVulnerabilities(first: 5, ecosystem: MAVEN, package: "com.fasterxml.jackson.core:jackson-databind") { nodes { advisory { summary severity publishedAt } vulnerableVersionRange firstPatchedVersion { identifier } } } }'Length of output: 2646
Script:
#!/bin/bash # Check if jackson-databind dependency exists in the pom.xml echo "Checking for jackson-databind in pom.xml..." cat test-environments/lombok/pom.xml | grep -A 4 "jackson-databind"Length of output: 331
test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java (2)
Line range hint
76-89
: Replace System.out.println with proper loggingUsing System.out.println for logging is not suitable for production. Consider using the Dropwizard logging framework.
+private static final Logger logger = LoggerFactory.getLogger(ParityCheckerListener.class); @Override public void parityCheckSucceeded(Object primary, Object pibified, Object requestContext) { - System.out.println("Parity check succeeded"); + logger.info("Parity check succeeded"); } @Override public void parityCheckFailed(Object primary, Object pibified, Object requestContext, AssertionError ae) { - System.out.println("Parity check failed"); + logger.error("Parity check failed", ae); } @Override public void parityCheckError(Object primary, Object pibified, Object requestContext, Throwable e) { - System.out.println("Parity check error"); + logger.error("Parity check error", e); }
Line range hint
1-89
: Fix Java version mismatch in pom.xmlThe pipeline failure indicates a Java version mismatch. Dropwizard requires Java 11 (class version 55.0) but the project is configured for Java 8 (class version 52.0).
Update the maven-compiler-plugin configuration in pom.xml:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <source>1.8</source> - <target>1.8</target> + <source>11</source> + <target>11</target> </configuration> </plugin>
🧹 Nitpick comments (11)
test-environments/dropwizard/test-dropwizard/pom.xml (2)
Line range hint
108-143
: Review dependency version management in pibify-maven-plugin.The plugin declares explicit versions for dependencies that are already managed by dropwizard-dependencies BOM. This can lead to version conflicts.
Consider removing explicit versions and inheriting them from the BOM:
<dependencies> <dependency> <groupId>io.dropwizard</groupId> <artifactId>dropwizard-core</artifactId> - <version>4.0.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.17.2</version> </dependency> <!-- Similar changes for other dependencies --> </dependencies>
Line range hint
175-189
: Clean up reporting configuration.The reporting section needs attention:
- Remove commented out configuration
- Specify version for maven-javadoc-plugin
Apply these changes:
<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <configuration> - <!-- <dependencyLocationsEnabled>false</dependencyLocationsEnabled>--> <dependencyDetailsEnabled>false</dependencyDetailsEnabled> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> + <version>3.6.3</version> </plugin> </plugins> </reporting>test-environments/lombok/pom.xml (3)
Line range hint
32-42
: Consider consolidating compiler plugin configurations.There are two separate configurations for the maven-compiler-plugin. Consider consolidating them into a single configuration with multiple executions.
Here's a suggested refactor:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>8</source> <target>8</target> </configuration> + <executions> + <execution> + <id>default-compile</id> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>compile-generated-pibify-sources</id> + <phase>prepare-package</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>${maven-compiler-plugin.version}</version> - <executions> - <execution> - <id>compile-generated-pibify-sources</id> - <phase>prepare-package</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - </plugin>Also applies to: 83-96
Line range hint
2-4
: Update copyright year.The copyright year is set to 2025, which is the current year. Consider using a range (e.g., 2023-2025) if this is not a new file.
Line range hint
29-31
: Consider using properties for dependency versions.For better maintainability, consider extracting dependency versions into properties, similar to how maven-compiler-plugin.version is managed.
Here's a suggested addition to the properties section:
<properties> <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version> + <lombok.version>1.18.22</lombok.version> + <jackson.version>2.17.2</jackson.version> + <pibify.version>1.6</pibify.version> </properties>Then update the dependencies to use these properties:
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>1.18.22</version> + <version>${lombok.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.17.2</version> + <version>${jackson.version}</version> <scope>test</scope> </dependency>Also applies to: 101-120
test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java (3)
Line range hint
1-15
: Update copyright year to current year (2025 → 2024)The copyright notice shows a future year.
- *Copyright [2025] [Original Author] + *Copyright [2024] [Original Author]
24-28
: Complete the class documentationThe class documentation is incomplete and missing its purpose description.
/** - * This class is used for + * This class represents a product entity with identifiable attributes like id, name, weight, and price. + * Each field is annotated with @Pibify for serialization/deserialization ordering. * Author bageshwar.pn * Date 02/10/24 */
30-40
: Consider adding validation constraintsThe fields are properly annotated with @Pibify for ordering, but consider adding validation constraints (e.g., @NotNull, @min, @max) to ensure data integrity.
@Pibify(1) +@NotNull String id; @Pibify(2) +@NotNull String name; @Pibify(3) +@Min(0) int weight; @Pibify(4) +@Min(0) double price;pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java (2)
Line range hint
1-15
: Update copyright year to current year (2025 → 2024)The copyright notice shows a future year.
- *Copyright [2025] [Original Author] + *Copyright [2024] [Original Author]
30-32
: Consider using SLF4J for loggingUsing java.util.logging directly creates a dependency on the JDK logging framework. Consider using SLF4J for better logging flexibility.
-import java.util.logging.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -private static final Logger logger = Logger.getLogger(PibifyConfiguration.class.getName()); +private static final Logger logger = LoggerFactory.getLogger(PibifyConfiguration.class);test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java (1)
Line range hint
1-15
: Update copyright year to current year (2025 → 2024)The copyright notice shows a future year.
- *Copyright [2025] [Original Author] + *Copyright [2024] [Original Author]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
pibify-core/src/main/java/com/flipkart/pibify/core/PibifyConfiguration.java
(2 hunks)pom.xml
(1 hunks)test-environments/dropwizard/test-dropwizard/pom.xml
(1 hunks)test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java
(2 hunks)test-environments/lombok/pom.xml
(1 hunks)test-environments/vertx/pom.xml
(1 hunks)test-environments/vertx/src/main/java/com/flipkart/pibify/Product.java
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- pom.xml
🧰 Additional context used
🪛 GitHub Actions: Java CI with Maven
test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java
[error] 30-30: Class file version mismatch: io.dropwizard.core.Application has version 55.0 but project requires 52.0
🔇 Additional comments (6)
test-environments/dropwizard/test-dropwizard/pom.xml (1)
27-27
: LGTM! Improved project identification.The changes to
groupId
andname
follow Maven best practices:
com.pibify
follows the reverse domain name conventionpibify-test-dropwizard
clearly indicates the module's purposeAlso applies to: 32-32
test-environments/vertx/pom.xml (3)
Line range hint
31-144
: Consider centralizing dependency management.The POM file has several dependencies with fixed versions. Consider:
- Moving versions to
<properties>
or a parent POM's<dependencyManagement>
section- Regular security audits for dependencies, especially for
jackson-databind
Here's how you could refactor the versions:
<properties> <maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version> <pibify-annotation-processor.version>1.1</pibify-annotation-processor.version> + <vertx.version>4.5.9</vertx.version> + <jackson.version>2.17.2</jackson.version> + <junit-jupiter.version>5.9.1</junit-jupiter.version> </properties>Let's check for any security advisories:
49-49
: Verify compatibility with the new plugin version.The plugin version has been updated from 1.3 to 1.6. While this aligns with the pibify-core dependency version, please ensure there are no breaking changes that could affect the build process.
Let's check the changelog and usage across the project:
✅ Verification successful
✓ Version update is consistent across the project
All modules using the pibify-maven-plugin have been updated to version 1.6, maintaining consistency throughout the codebase:
- test-environments/lombok
- test-environments/vertx
- test-environments/pibify-test-vanilla
- test-environments/dropwizard/test-dropwizard
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any potential incompatibilities or required updates # 1. Search for plugin usage patterns that might need updates rg -g "pom.xml" "pibify-maven-plugin" # 2. Check if all modules are using consistent versions rg -g "pom.xml" "com\.flipkart\.pibify.*version"Length of output: 721
Script:
#!/bin/bash # Check parent POM for version management echo "=== Parent POM Version Management ===" rg -A 5 "<dependencyManagement>|<pluginManagement>" pom.xml # Extract version declarations from each module echo -e "\n=== Module Version Declarations ===" for pom in $(rg --files-with-matches "pibify-maven-plugin" -g "pom.xml"); do echo "=== $pom ===" rg -A 3 "<artifactId>pibify-maven-plugin</artifactId>" "$pom" doneLength of output: 2727
50-56
: Review architectural change in plugin dependency.The addition of
vertx-core
as a plugin dependency suggests a significant change in how the plugin interacts with Vert.x. This architectural change warrants careful review:
- Why does the plugin now need direct access to Vert.x APIs?
- Could this create classloader issues since vertx-core exists both as a plugin and project dependency?
Let's verify the version stability and usage:
✅ Verification successful
Plugin dependency on vertx-core is justified and properly configured.
The vertx-core dependency in the plugin configuration is necessary for source generation and maintains version consistency (4.5.9) across all usages. The architecture is sound with appropriate scope management to prevent runtime conflicts.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any potential version conflicts or inconsistencies # 1. Search for all vertx-core version references rg -g "pom.xml" "vertx-core.*version" # 2. Look for any direct plugin usages of Vert.x APIs ast-grep --pattern 'import io.vertx.$_'Length of output: 79
Script:
#!/bin/bash # Search for vertx-core dependencies with broader patterns echo "=== Searching for vertx-core dependencies ===" rg -g "pom.xml" "<artifactId>vertx-core</artifactId>" -C 5 # Search for any Vertx imports or usage in Java/Kotlin files echo "=== Searching for Vertx imports in source files ===" rg -t java -t kotlin "import.*io\.vertx" -C 2 # Check plugin configuration files echo "=== Checking plugin configurations ===" fd "pom.xml" test-environments/vertx -x cat {}Length of output: 11985
test-environments/lombok/pom.xml (1)
47-47
: Verify pibify component versions across the project.The version update to 1.6 for pibify-maven-plugin aligns with the PR objective of standardizing versions.
Run this script to verify version consistency across all pom.xml files:
✅ Verification successful
Version consistency verified
All pibify components (maven-plugin and core) consistently use version 1.6 across the entire project.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for any inconsistencies in pibify component versions echo "Checking pibify component versions..." fd -e xml -x grep -l "com.flipkart.pibify" {} \; | xargs grep -A 1 "<artifactId>pibify-"Length of output: 2660
test-environments/dropwizard/test-dropwizard/src/main/java/com/flipkart/pibify/PibifyDemoApplication.java (1)
Line range hint
37-37
: Address TODO comment for integration testsThe TODO comment indicates missing integration tests. This should be addressed to ensure proper testing coverage.
Would you like me to help create integration tests or create a GitHub issue to track this task?
if (PibifyConfiguration.INSTANCE != null) { | ||
throw new IllegalStateException("Re-creating pibify configuration"); | ||
logger.warning("Re-creating pibify configuration"); | ||
} | ||
PibifyConfiguration.INSTANCE = config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconsider replacing exception with warning log
Replacing the exception with a warning log when recreating configuration could lead to silent failures and unexpected behavior. Consider:
- Either keeping the exception to prevent reconfiguration
- Or implementing a proper reconfiguration mechanism with validation
if (PibifyConfiguration.INSTANCE != null) {
- logger.warning("Re-creating pibify configuration");
+ throw new IllegalStateException("Configuration already initialized. Use reset() method for reconfiguration.");
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if (PibifyConfiguration.INSTANCE != null) { | |
throw new IllegalStateException("Re-creating pibify configuration"); | |
logger.warning("Re-creating pibify configuration"); | |
} | |
PibifyConfiguration.INSTANCE = config; | |
if (PibifyConfiguration.INSTANCE != null) { | |
throw new IllegalStateException("Configuration already initialized. Use reset() method for reconfiguration."); | |
} | |
PibifyConfiguration.INSTANCE = config; |
@@ -55,10 +55,12 @@ public void initialize(final Bootstrap<PibifyDemoConfiguration> bootstrap) { | |||
public void run(final PibifyDemoConfiguration configuration, | |||
final Environment environment) { | |||
|
|||
environment.jersey().register(new JakartaPibifyMessageBodyWriter(PibifyHandlerCache.getInstance(), new PibifySampler())); | |||
AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Avoid hardcoding class names as strings
Using hardcoded class name strings can lead to runtime errors if the class name changes. Consider using Class.getName() instead.
-AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache");
+Class<?> handlerCacheClass = Class.forName("com.pibify.pibify.generated.test.dropwizard.PibifyHandlerCache");
+AbstractPibifyHandlerCache handlerCache = AbstractPibifyHandlerCache.getConcreteInstance(handlerCacheClass.getName());
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/maven.yml
(1 hunks)
🔇 Additional comments (1)
.github/workflows/maven.yml (1)
24-29
: Good choice of GitHub Actions configuration!The workflow uses:
- Latest
actions/setup-java@v4
- Eclipse Temurin distribution (well-maintained OpenJDK distribution)
- Maven dependency caching for faster builds
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
java-version: '17' | ||
distribution: 'temurin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
JDK 17 upgrade requires source/target updates in all modules
The codebase is currently standardized on Java 8 across all modules. Upgrading the GitHub Actions environment to JDK 17 while the project is configured to use Java 8 may lead to build issues. You need to:
- Update
<source>8</source>
and<target>8</target>
to17
in all module POMs:- pibify-core/pom.xml
- pibify-maven-plugin/pom.xml
- test-environments/vertx/pom.xml
- test-environments/lombok/pom.xml
- test-environments/dropwizard/test-dropwizard/pom.xml
- test-environments/pibify-test-vanilla/pom.xml
🔗 Analysis chain
Verify JDK 17 compatibility across all modules.
The upgrade from JDK 8 to 17 is a significant change. While moving to a modern Java version is good, we should ensure all modules and dependencies are compatible with JDK 17.
Let's verify the Java version requirements in the new uber pom:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check Java version requirements in pom files
# Look for maven.compiler.source, maven.compiler.target, and java.version properties
# Check root pom
echo "Checking root pom.xml:"
rg -A 2 '<(maven\.compiler\.(source|target)|java\.version)>' pom.xml
# Check all module poms
echo -e "\nChecking module pom files:"
fd pom.xml --exclude target/ --exec rg -A 2 '<(maven\.compiler\.(source|target)|java\.version)>'
Length of output: 293
Script:
#!/bin/bash
# Search for Java version related configurations more broadly
echo "=== Checking Java version configurations in pom files ==="
fd pom.xml --exclude target/ --exec sh -c 'echo "\nFile: {}"; cat {} | grep -A 5 -E "(<properties>|<plugin>.*compiler|<parent>)"'
# Search for any maven compiler plugin configurations
echo -e "\n=== Checking specific compiler configurations ==="
rg -A 10 '<artifactId>maven-compiler-plugin</artifactId>'
Length of output: 13081
Fixes #7
Summary by CodeRabbit
Release Notes
New Features
Dependency Updates
pibify-maven-plugin
version to 1.6.pibify-core
dependency to version 1.6.vertx-core
dependency to Maven plugin.Code Improvements
@Pibify
annotations to model classes.Test Environments
Workflow Updates