May 5 (UPI) -- Actress and producer Blake Lively and Justin Baldoni, her It Ends with Us director and co-star, have settled their lawsuit two weeks ahead of a scheduled federal jury trial.

The settlement ends an 18-month legal battle that saw Lively accuse Baldoni of sexual harassment on the 2024 film's set, then hiring a publicity team to tarnish her reputation online when she complained about it.

Baldoni counter-sued Lively for defamation, but that lawsuit was quickly dismissed.

The terms of their settlement were not disclosed.

"The end product -- the movie It Ends With Us -- is a source of pride to all of us who worked to bring it to life," said a joint statement released by both parties' attorneys on Monday.