javastreamarchunit

Arch test failing STANDARD_STREAMS


I have app which folowing by archunit rules and I get:

NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS

failed rule - it's mean I can't use standard Java I/O Streams. But what I can use instead?

How I can avoid this architecture rule with another Java methods instead standard streams? Because My arch rules are failing


Solution

  • This Oracle blog entry says:

    The Library API also contains the GeneralCodingRules class, which includes predefined and self-describing static coding rules that are common in many Java projects, for example:

    NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS (that is, the System.out, System.err, and printStackTrace methods: use a logging library instead)

    So I think you need remove all println System.out.println()