Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 19, 2025

  • Create new package org.codehaus.plexus.build.messages
  • Create MessageType enum for message severity levels (INFO, WARNING, ERROR)
  • Create Message class to hold message parameters
  • Create MessageBuilder class with builder pattern implementation
  • Create Messages interface with clearAll, clear, and build methods
  • Create DefaultMessages implementation using BuildContext
  • Update README.md to document the new Messages API
  • Build and verify the implementation
  • Address code review feedback (improve log formatting, clarify INFO to WARNING mapping)
  • Address review comments:
    • Make Message constructor package-private
    • Rename methods to shorter names (error, warning, info)
    • Change create() to require message parameter
    • Map INFO to severity 0 (undocumented BuildContext feature)
    • Remove copyright lines per ASF guidelines
    • Add deprecation warnings to BuildContext methods
  • Address additional review feedback:
    • Add @deprecated annotations to addMessage and removeMessages
    • Move formatLogMessage logic to Message.toString() for better reusability
    • Keep message.trim().isEmpty() for blank check (Java 8 compatible)
Original prompt

This section details on the original issue you should resolve

<issue_title>Creaze a dedicated Messages API</issue_title>
<issue_description>Currently we have the BuildContext that it mixing two concerns:

  1. Resource Operations (see Provide a new Resources API #76)
  2. Creating Messages/Markers that inform the user in an IDE about issues on their files

For the Messages/Markers we even have some outstanding issues:

due to backward-compatibility we can hardly change them or make any useful evolution.

Because of this we want a new API that is implemented in the following way:

  • Create a new package org.codehaus.plexus.build.messages where we have a Messages interface
  • Document it in the https://github.com/codehaus-plexus/plexus-build-api/blob/master/README.md#provided-apis section of the readme
  • The Messages interface should have a method "clearAll" that clears all messages and a clear method that takes a path
  • Beside that we want to have a builder pattern to construct a message in a more convenient, flexible and extensible ways: buildError, buildWarning, buildInfo that all delegate to a generic build that takes an enum for the type of message to build. Beside that each method must accept a Path for wich a message should be build
  • There should be a DefaultMessages component that gets the BuildContext it injected in the contructor to proof the API is implementable
  • The builder should be implemented in a class MessageBuilder that takes the type enum, the path and a Consumer of a constructed "Message" class that holds all collected parameter in one object, that way implementers of the API do not need to reimplement the builder, but the javadoc should state that this is usually nothing client code will call
  • For all other current parameters the builder needs to have a appropriate method (e.g. line(int), column(int), message(String), cause(Exception)) that return the builder for chaining
  • the MessageBuilder#create() method will the create a message object and inform the consumer, where the DefaultMessages implementation should log the message and call the old message API in the BuildContext, clearAll will be a noop here

</issue_description>

<agent_instructions>Implement like described in the issue, a test is not yet needed to be implemented yet.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #102


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI self-assigned this Oct 19, 2025
Copilot AI and others added 2 commits October 19, 2025 17:54
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Create a dedicated Messages API for user notifications Create dedicated Messages API Oct 19, 2025
@Copilot Copilot AI requested a review from laeubi October 19, 2025 17:58
Copilot finished work on behalf of laeubi October 19, 2025 17:58
Copy link
Collaborator

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

@copilot see my review comments here for some changes, additionally we should mark the corresponding method in BuildContext as deprecated with a note to the new API to use.

…uctor, copyright removal, create(String message)

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot see my review comments here for some changes, additionally we should mark the corresponding method in BuildContext as deprecated with a note to the new API to use.

Added @deprecated annotations to addMessage and removeMessages methods in BuildContext in commit 6a17a42.

@Copilot Copilot AI requested a review from laeubi October 20, 2025 05:10
Copilot finished work on behalf of laeubi October 20, 2025 05:10
@laeubi laeubi marked this pull request as ready for review October 20, 2025 05:13
Copy link
Collaborator

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

@copilot just some smaller remarks

…ring()

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
@Copilot Copilot AI requested a review from laeubi October 20, 2025 05:24
Copilot finished work on behalf of laeubi October 20, 2025 05:24
Copy link
Collaborator

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

Looks good to me, anyone else likes to review?
Otherwise I would Squash+Merge this the next days.

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.

Creaze a dedicated Messages API

3 participants