Skip to content

[Fix #1515] Moving CronUtils dependency to a different module#1523

Merged
ricardozanini merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1515
Jul 8, 2026
Merged

[Fix #1515] Moving CronUtils dependency to a different module#1523
ricardozanini merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1515

Conversation

@fjtirado

@fjtirado fjtirado commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Fix #1515

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #1515 by moving the cron-utils dependency out of impl/core into a dedicated impl/cron module, so downstream users don’t inherit cron parsing dependencies unless they need scheduler/cron functionality.

Changes:

  • Introduces a new serverlessworkflow-impl-cron module that provides a CronResolverFactory implementation via ServiceLoader.
  • Removes the cron-utils dependency from serverlessworkflow-impl-core and wires cron factory loading into WorkflowApplication.
  • Updates implementation/test and jackson modules plus documentation to include/mention the new cron module.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
impl/test/pom.xml Adds serverlessworkflow-impl-cron to test classpath.
impl/README.md Documents the new serverlessworkflow-impl-cron module.
impl/pom.xml Registers the new cron submodule and adds it to dependency management.
impl/jackson/pom.xml Adds dependency on serverlessworkflow-impl-cron.
impl/cron/src/main/resources/META-INF/services/io.serverlessworkflow.impl.scheduler.CronResolverFactory Registers cron provider for ServiceLoader.
impl/cron/src/main/java/io/serverlessworkflow/impl/cron/CronUtilsResolverFactory.java New cron-utils-backed CronResolverFactory implementation.
impl/cron/src/main/java/io/serverlessworkflow/impl/cron/CronUtilsResolver.java New cron-utils-backed CronResolver implementation.
impl/cron/pom.xml Defines the new cron module and its dependencies.
impl/cron/.checkstyle Adds an IDE checkstyle config file (problematic due to absolute paths).
impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Loads CronResolverFactory via ServiceLoader and constructs scheduler with it.
impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/DefaultWorkflowScheduler.java Removes the no-arg constructor tied to cron-utils implementation.
impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/CronResolverFactory.java Makes CronResolverFactory a prioritized service.
impl/core/pom.xml Removes the cron-utils dependency from core.
Comments suppressed due to low confidence (1)

impl/cron/src/main/java/io/serverlessworkflow/impl/cron/CronUtilsResolverFactory.java:24

  • CronUtilsResolverFactory is registered via META-INF/services/...CronResolverFactory, but the provider class is package-private. ServiceLoader requires the provider class to be public (and have a public no-arg constructor) or it will fail to instantiate it at runtime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 15:49
@fjtirado fjtirado force-pushed the Fix_#1515 branch 2 times, most recently from a8d62e0 to 6888ba5 Compare July 8, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/DefaultWorkflowScheduler.java:34

  • Removing the public no-arg constructor is a source/binary breaking change for downstream users that instantiate DefaultWorkflowScheduler directly. Consider keeping the no-arg constructor and resolving CronResolverFactory via ServiceLoader (with a safe fallback) so the core module can stay free of cron-utils while preserving the API.
  public DefaultWorkflowScheduler(
      ScheduledExecutorService service, CronResolverFactory cronFactory) {
    super(service);
    this.cronFactory = cronFactory;
  }

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

impl/core/src/main/java/io/serverlessworkflow/impl/scheduler/DefaultWorkflowScheduler.java:34

  • Removing the no-arg DefaultWorkflowScheduler() constructor is a breaking API change for downstream users who may instantiate it directly. Consider reintroducing it and loading CronResolverFactory via ServiceLoader (or failing fast with a clear exception) so impl-core can remain cron-utils-free without breaking existing code.
  public DefaultWorkflowScheduler(
      ScheduledExecutorService service, CronResolverFactory cronFactory) {
    super(service);
    this.cronFactory = cronFactory;
  }

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowApplication.java Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread impl/jackson/pom.xml

@ricardozanini ricardozanini left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add optional to the jackson lib or cron-utils will be imported anyway.

…ent module

Signed-off-by: fjtirado <ftirados@ibm.com>
Copilot AI review requested due to automatic review settings July 8, 2026 19:21
@ricardozanini ricardozanini merged commit cab7ecf into serverlessworkflow:main Jul 8, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment on lines +476 to +490
new CronResolverFactory() {
private CronResolver emptyResolver =
new CronResolver() {
@Override
public Optional<Duration> nextExecution() {
throw new UnsupportedOperationException(
"Missing CronResolverFactory, please add serverlessworkflow-impl-cron dependency to your classpath");
}
};

@Override
public CronResolver parseCron(String cron) {
return emptyResolver;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move cron-utils dependency to a separated scheduler module

3 participants