Closed lolodomo closed 2 years ago
I even don't find this project org.openhab.addons.reactor.bundles in the repo.
And the Static code analysis summary report contains no additional information.
Just to mention this is maven run just after cloning the git repo and after installing a new JDK 11.
$ git branch
* main
$ git status
On branch main
Your branch is up-to-date with 'origin/main'.
nothing to commit, working tree clean
$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)
$ mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: C:\Program Files\apache-maven-3.5.0
Java version: 11.0.8, vendor: AdoptOpenJDK
Java home: C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-hotspot
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I run into that problem sometimes, too. I guess it‘s something with the git line-ending setting.
You can use -D“spotless.check.skip“=true
to skip the check.
I got the same error when running mvn clean install -D“spotless.check.skip“=true
Check bypassed if I use the following command: mvn clean install -Dspotless.check.skip=true
without the ""
This is probably something to add in the documentation in addtion to -DskipChecks
and -DskipTests
.
I am on Windows. You say if could be git line-ending setting. Could it be a wrong line encoding of this POM file ?
My feeling is that it‘s more a spotless bug (could be it doesn‘t detect the correct line-ending).
Very interestingnit works for you without the "". It‘s not working for me without. Are you using cmd
(„Eingabeaufforderung“ in german, not sure how it is labelled in other languages) or Powershell?
It was run from a Git Bash window.
With spotless checking disabled, the build succeeded.
It takes 1h14'. I have the feeling it takes largely more time than before (OH2) (twice the time ?). Here are the bindings that took more than 30s to build:
[INFO] openHAB Add-ons :: Bundles :: Adorne Binding ....... SUCCESS [ 45.838 s]
[INFO] openHAB Add-ons :: Bundles :: Chromecast Binding ... SUCCESS [ 56.020 s]
[INFO] openHAB Add-ons :: Bundles :: IO :: Modbus Transport SUCCESS [ 41.393 s]
[INFO] openHAB Add-ons :: Bundles :: Netatmo Binding ...... SUCCESS [ 45.396 s]
[INFO] openHAB Add-ons :: Bundles :: Smartmeter Binding ... SUCCESS [ 55.726 s]
[INFO] openHAB Add-ons :: Bundles :: Tellstick Binding .... SUCCESS [ 36.847 s]
[INFO] openHAB Add-ons :: Bundles :: IO :: Homekit ........ SUCCESS [ 32.935 s]
[INFO] openHAB Add-ons :: Bundles :: IO :: Hue Emulation Service SUCCESS [01:11 min]
[INFO] openHAB Add-ons :: Bundles :: Persistence Service :: DynamoDB SUCCESS [ 50.583 s]
[INFO] openHAB Add-ons :: Bundles :: Persistence Service :: InfluxDB SUCCESS [ 44.463 s]
[INFO] openHAB Add-ons :: Bundles :: Persistence Service :: JDBC SUCCESS [ 44.501 s]
[INFO] openHAB Add-ons :: Bundles :: Persistence Service :: JPA SUCCESS [ 52.672 s]
[INFO] openHAB Add-ons :: Bundles :: Voice :: Mary Text-to-Speech SUCCESS [01:17 min]
[INFO] openHAB Add-ons :: Integration Tests :: Feed Binding Tests SUCCESS [02:46 min]
[INFO] openHAB Add-ons :: Integration Tests :: Nest Binding Tests SUCCESS [ 32.563 s]
[INFO] openHAB Add-ons :: Integration Tests :: Systeminfo Binding Tests SUCCESS [01:02 min]
It only takes 18'54'' if I skip checks and tests.
It was run from a Git Bash window.
It might cause Spotless to think you prefer Unix-like line endings while Git thinks you prefer DOS/Windows line endings.
See also the Spotless line endings documentation:
Git has opinions about line endings, and if Spotless and git disagree, then you're going to have a bad time.
The only increase in build times I have noticed is due to more add-ons having been merged recently. I added some more options to the README that you can use to improve build times in https://github.com/openhab/openhab-addons/pull/8767.
Try disabling feature verification and a parallel build, e.g.:
mvn clean install -DskipChecks=true -DskipTests=true -Dfeatures.verify.skip=true -Dspotless.check.skip=true -T 1C
With that it only takes ~1 minute to build all add-ons on my machine.
The result (error) is the same if I use Windows PowerShell.
@wborn I think you are right about the line endings. It seems if you checkout .xml files with Linux \n file endings on Windows maven finds the file invalid (which I can imagine), but if you checkout with Windows line endings \r\n spotless does think the file has bad formatting.
If you let spotless allow Windows line endings on Windows (if this is possible, didn't check yet) and you commit them with Windows line endings, you have mixed Linux and Windows line endings in the repository, also the spotless checks of the buildserver will fail. Still I think this is the best solution and if a Windows user commits files with the wrong line endings, the commits won't be merged until the line endings are 'correct' (i.e. Linux).
One way to have better control as project over line endings is to add a .gitattributes file to the project with:
* text=auto
and if needed specify which file need to be handled as text if autodetection fails:
*.xml text
*.java text
See also: https://github.com/diffplug/spotless/issues/35
I think .gitattributes should be added to the project and spotless should be to configured to lineEndings 'GIT_ATTRIBUTES'
Looks like the .gitattributes
wasn't added when Spotless was activated on the master/main branch. We already have this file on the 2.5.x branch, see: https://github.com/openhab/openhab-addons/blob/2.5.x/.gitattributes
I'll create some PRs to add it to this branch and the other projects.
@wborn Thanks! _Note: I just learned GITATTRIBUTES as line endings option is the default (and recommended) configuration for spotless.
I hope it also solves @lolodomo's issues. If you did not have them on the 2.5.x branch they should now be solved as well. :-)
It solves the problem for me :)
I updated my local repo but unfortunately I still have the same problem when I try to compile the main branch.
Damn sorry @wborn.... @lolodomo is correct.. I've retried with a full clean checkout and build and it fails again (with .gitattributes added by hand for openhab-core).
If it did work on 2.5.9, what else is different?
I think I know what might go wrong. openhab-core/tools/static-code-analysis/checkstyle/ruleset.properties defines:
checkstyle.headerCheck.content=^/\\*\\*$\\n^ \\* Copyright \\(c\\) {0}-{1} Contributors to the openHAB project$\\n^ \\*$\\n^ \\* See the NOTICE file\\(s\\) distributed with this work for additional$\\n^ \\* information.$\\n^ \\*$\\n^ \\* This program and the accompanying materials are made available under the$\\n^ \\* terms of the Eclipse Public License 2\\.0 which is available at$\\n^ \\* http://www.eclipse.org/legal/epl\\-2\\.0$\\n^ \\*$\\n^ \\*
With explicit linux line endings... This is also where I now get the error (which is different then before)
Perhaps there is one of the @openhab/add-ons-maintainers who uses Windows and can check if there are still Spotless issues on the main branch and what could fix them? I have no issues or easy ways to reproduce this on Ubuntu. :wink:
I don't think it is the openhab-core/tools/static-code-analysis/checkstyle/ruleset.properties
\n seems to work, changing it to \r\n gives pattern match errors. If addons do build I could check how they are configured.
For some reason spotless seems to ignore .gitattributes on master. I am lost why it is. Even setting the value to crlf instead of auto does not make stop complaining line endings should be \n only.
Try the main
branch instead of master
. The master
branch is no longer used.
openhab-core still uses master I know this issue is in openhab-addons, but the problem is also present on openhab-core.
https://github.com/diffplug/spotless/issues/540 related? Looking into it...
I get the same error (on Win 10) if I start from the root-POM. Building single projects with -pl
works. The interesting thing is, that mvn clean install -rf :org.openhab.addons.reactor.bundles
also works.
I can confirm that build from inside a binding is working. Problem is when you build from the repo root folder.
git config core.eol=crlf
solves the problem. This is not a problem since autcrlf=true
takes precendence and git's behaviour stays unchanged.
You might want * text eol=native
, see https://github.com/diffplug/spotless/issues/540
Is this still an open issue ?
For me it works fine on Windows using:
git config --global core.autocrlf false
git config --global core.eol crlf
I have to test these settings.
If it works better we probably want to update the developer docs as well. Sometimes those .gitattributes
changes end up in PRs by Windows contributors. :confused:
For me it works fine on Windows using:
git config --global core.autocrlf false git config --global core.eol crlf
Tried and working. Thank you
Even using
-DskipChecks
does not help avoiding this blocking step.Is there a way to disable this check ?