For the declaration element we took the easy route and use the single line 
element as it gets regenerated by the release.

 This is actually a good thing it contains absolutely nothing of value, so 
wasting only one line is ok (you just must get over the need of printing it on 
paper ,)


--
http://bernd.eckenfels.net
________________________________
Von: Eric Lilja <[email protected]>
Gesendet: Tuesday, February 4, 2020 7:35:01 PM
An: Maven Developers List <[email protected]>
Betreff: Re: Prevent maven-release-plugin from reformatting attributes on 
project element

Sure! Today I did a release in a single module project. The unwanted diff
was that the release plugin changed

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

to

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

So it discarded our formatting (which had a linebreak after the
xmlns:xsi-attribute and aligned xsi:schemaLocation-attribute, column-wise,
with the xmlns-attribute, in case formatting is lost in the email) and put
all attributes on the same line as its containing element (element
"project", in this case).

I don't know if it happens only for this element or not, in our pom-files,
that is usually the only element that has so many attributes that our
formatter line splits it.

We're trying to make sure formatting is always correct in our code-base, to
get rid of unwanted noise in git diffs to make reviews smaller, that's why
this is a slight nuisance to us.

The release was done on Linux machine. All files have unix-style line
breaks, indentation is four spaces.

- Eric L

On Tue, Feb 4, 2020 at 6:47 PM Hervé BOUTEMY <[email protected]> wrote:

> can you provide an example of reformatting, please?
>
> in every case I saw until now, there is no reformatting, so I suppose
> you're
> in a case I did not expect
>
> Regards,
>
> Hervé
>
> Le mardi 4 février 2020, 16:24:54 CET Eric Lilja a écrit :
> > > I see.
> > > I am not aware of any such feature.
> > > If you have some tool that pretty prints XML according to your
> > > comporate rules you could invoke it in completionGoals [1]
> >
> > That could be a workaround for now. Thanks!
> >
> > - Eric L
> >
> > > Enrico
> > >
> > > [1]
> > >
> http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.ht
> > > ml#completionGoals
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to