generated from lengors/maven-java-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Pedro Xavier Leite Cavadas edited this page Sep 5, 2024
·
1 revision
This page addresses common issues that may arise while using js2pets in your Maven or Gradle projects.
If your POJOs are not being generated or are missing certain features, try the following:
-
Check Plugin Configuration: Ensure that the jsonschema2pojo plugin and js2pets dependency are properly configured in your
pom.xml
(for Maven) orbuild.gradle.kts
(for Gradle). - Version Mismatch: Verify that the jsonschema2pojo and js2pets versions are compatible. Outdated versions can sometimes cause unexpected behavior.
- Schema Issues: Check if your JSON schema is valid and correctly formatted, as jsonschema2pojo will fail if the schema is malformed.
If the custom rules for constructors (e.g., skipping no-args constructors) are not working:
-
Verify Rule Factory: Make sure the
customRuleFactory
is set toio.github.lengors.js2pets.factories.EnhancedRuleFactory
. -
Configuration Parameters: Double-check that
includeConstructors
andincludeNoArgsConstructor
are properly set in your configuration. -
Gradle-Specific Issues: For Gradle users, ensure you're explicitly choosing between
IncludeNoArgsConstructor
orExcludeNoArgsConstructor
in the rule factory, as js2pets currently doesn't infer the behavior for Gradle-based projects automatically.
If Maven or Gradle cannot resolve js2pets or jsonschema2pojo dependencies:
- Check Repositories: Ensure your project is using a repository that includes the necessary dependencies (e.g., Maven Central).
- Update Dependency Version: Make sure you're using the latest versions of js2pets and jsonschema2pojo. You may need to update your project’s dependencies.
-
Verbose Logging in Maven: Use
mvn -X
to enable verbose logging and get more detailed error messages. -
Gradle Debugging: For Gradle, use
--info
or--debug
to gain more insight into what might be going wrong.
If the above solutions do not resolve your issue, consider opening a detailed issue on the GitHub repository with information about your project setup and any error logs you're seeing.