Skip to content

How can I configure line length in Java? #763

@H00fie

Description

@H00fie

Hello,

So I already found a thread about the issue, but I fail to understand the solution.

I understand that googleJavaFormat will not allow me to modify the length of the lines of my code and I need to rely on eclipse formatter.
@nedtwigg provided an answer saying that below are keys I should care about:

<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="999"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="999"/>

My problem is when I implement these and try to build the project... it says that "setting" does not exist at all. I also keep failing while trying to make my project use an external XML file to configure the length of the lines:

<configuration>
                    <java>
                        <eclipse>
                            <version>4.13.0</version>
                            <file>${basedir}/muh-code-style.xml</file>
                        </eclipse>
                        <removeUnusedImports/>
                    </java>
</configuration>

Any idea what I am doing wrong? All I want is to set a column limit at around 140.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions