You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andres Almiray <aa...@gmail.com> on 2021/08/02 14:47:26 UTC

Color output

Hello everyone,

What is the recommended way for logging text with color?
I'd like to print out text where some portions of it should have different
colors.

Cheers,
Andres
-------------------------------------------
Java Champion; Groovy Enthusiast
https://andresalmiray.com
https://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and
those who don't.
To understand recursion, we must first understand recursion.

Re: Color output

Posted by Maarten Mulders <mt...@apache.org>.
Hi Andres,

Not sure if you could get it injected, but from what I see in the 
"dependency:resolve" MoJo (ResolveDependenciesMojo class, Maven 
Dependency Plugin), you could get one by doing

     MessageBuilder messageBuilder = MessageUtils.buffer();

The MessageUtils.buffer() method (also from maven-shared-utils) will 
give you the JAnsi backed implementation if JAnsi is available, and the 
PlainMessageBuilder otherwise.

HTH,

Maarten

On 02/08/2021 19:34, Andres Almiray wrote:
> Hi Maarten,
> 
> Yes, that looks like what I need.
> Do you happen yo know how I can get an instance of that interface injected
> into a Mojo?
> 
> Cheers,
> Andres
> 
> -------------------------------------------
> Java Champion; Groovy Enthusiast
> https://andresalmiray.com
> https://www.linkedin.com/in/aalmiray
> --
> What goes up, must come down. Ask any system administrator.
> There are 10 types of people in the world: Those who understand binary, and
> those who don't.
> To understand recursion, we must first understand recursion.
> 
> 
> On Mon, Aug 2, 2021 at 7:16 PM Maarten Mulders <mt...@apache.org>
> wrote:
> 
>> Hi Andres,
>>
>> Guess you're looking for MessageBuilder interface, which lives in
>> maven-shared-utils. There are two implementations, the
>> PlainMessageBuilder and AnsiMessageBuilder. The latter one generates the
>> colours on the terminal.
>>
>> HTH,
>>
>> Maarten
>>
>> On 02/08/2021 16:47, Andres Almiray wrote:
>>> Hello everyone,
>>>
>>> What is the recommended way for logging text with color?
>>> I'd like to print out text where some portions of it should have
>> different
>>> colors.
>>>
>>> Cheers,
>>> Andres
>>> -------------------------------------------
>>> Java Champion; Groovy Enthusiast
>>> https://andresalmiray.com
>>> https://www.linkedin.com/in/aalmiray
>>> --
>>> What goes up, must come down. Ask any system administrator.
>>> There are 10 types of people in the world: Those who understand binary,
>> and
>>> those who don't.
>>> To understand recursion, we must first understand recursion.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Color output

Posted by Andres Almiray <aa...@gmail.com>.
Hi Maarten,

Yes, that looks like what I need.
Do you happen yo know how I can get an instance of that interface injected
into a Mojo?

Cheers,
Andres

-------------------------------------------
Java Champion; Groovy Enthusiast
https://andresalmiray.com
https://www.linkedin.com/in/aalmiray
--
What goes up, must come down. Ask any system administrator.
There are 10 types of people in the world: Those who understand binary, and
those who don't.
To understand recursion, we must first understand recursion.


On Mon, Aug 2, 2021 at 7:16 PM Maarten Mulders <mt...@apache.org>
wrote:

> Hi Andres,
>
> Guess you're looking for MessageBuilder interface, which lives in
> maven-shared-utils. There are two implementations, the
> PlainMessageBuilder and AnsiMessageBuilder. The latter one generates the
> colours on the terminal.
>
> HTH,
>
> Maarten
>
> On 02/08/2021 16:47, Andres Almiray wrote:
> > Hello everyone,
> >
> > What is the recommended way for logging text with color?
> > I'd like to print out text where some portions of it should have
> different
> > colors.
> >
> > Cheers,
> > Andres
> > -------------------------------------------
> > Java Champion; Groovy Enthusiast
> > https://andresalmiray.com
> > https://www.linkedin.com/in/aalmiray
> > --
> > What goes up, must come down. Ask any system administrator.
> > There are 10 types of people in the world: Those who understand binary,
> and
> > those who don't.
> > To understand recursion, we must first understand recursion.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Color output

Posted by Maarten Mulders <mt...@apache.org>.
Hi Andres,

Guess you're looking for MessageBuilder interface, which lives in 
maven-shared-utils. There are two implementations, the 
PlainMessageBuilder and AnsiMessageBuilder. The latter one generates the 
colours on the terminal.

HTH,

Maarten

On 02/08/2021 16:47, Andres Almiray wrote:
> Hello everyone,
> 
> What is the recommended way for logging text with color?
> I'd like to print out text where some portions of it should have different
> colors.
> 
> Cheers,
> Andres
> -------------------------------------------
> Java Champion; Groovy Enthusiast
> https://andresalmiray.com
> https://www.linkedin.com/in/aalmiray
> --
> What goes up, must come down. Ask any system administrator.
> There are 10 types of people in the world: Those who understand binary, and
> those who don't.
> To understand recursion, we must first understand recursion.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org