Started getting compile error after mvn clean

(Mark) #1

The build of my binding was working fine on Friday. However, this morning (Saturday) after running a mvn clean, I started getting a build failure when doing a mvn install.

Here’s the error.

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.openhab.binding.weathercompany: Compilation failure: Compilation failure:
[ERROR] C:\Users\mark\openhab2-addons\addons\binding\org.openhab.binding.weathercompany\src\main\java\org\openhab\binding\weathercompany\internal\handler\WeatherCompanyHandler.java:[240]
[ERROR] return systemOfUnits instanceof ImperialUnits ? true : false;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Incompatible conditional operand types SystemOfUnits and ImperialUnits

I’m checking which measurement system is set in openHAB in order to determine whether to use Imperial or SI units to request weather forecast data from an online service.

systemOfUnits is defined as

private @NonNullByDefault({}) SystemOfUnits systemOfUnits;

And it’s initialized in the constructor like this.

this.systemOfUnits = unitProvider.getMeasurementSystem();

I don’t understand why it compiled yesterday and now is failing.

Is there a different/better way to check which Measurement System is being used?

The complete handler code is here.

Any help would be appreciated.

0 Likes

(Mark) #2

@wborn @hilbrand

I think you guys understand how the units stuff works. Am I doing something wrong? Why did the build fail all of a sudden?

0 Likes

(Wouter Born) #3

Maybe it helps if you rebuild openhab-core locally?

Your binding builds successfully on my machine:

[INFO] --- tycho-p2-plugin:1.2.0:update-local-index (default-update-local-index) @ org.openhab.binding.weathercompany ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.443 s
[INFO] Finished at: 2019-03-10T20:30:03+01:00
[INFO] ------------------------------------------------------------------------

There were some UoM class hierarchy related changes by @hilbrand recently, see also:

uom

0 Likes

(Mark) #4

How bizarre is this…

This morning I ran the build with this result.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.235 s
[INFO] Finished at: 2019-03-11T07:52:57-04:00
[INFO] Final Memory: 42M/445M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.openhab.binding.weathercompany: Compilation failure: Compilation failure:
[ERROR] C:\Users\mark\openhab2-addons\addons\binding\org.openhab.binding.weathercompany\src\main\java\org\openhab\binding\weathercompany\internal\handler\WeatherCompanyHandler.java:[248]
[ERROR] return systemOfUnits instanceof ImperialUnits ? true : false;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Incompatible conditional operand types SystemOfUnits and ImperialUnits

A few hours later after doing nothing, I ran it again with this result.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.814 s
[INFO] Finished at: 2019-03-11T13:35:04-04:00
[INFO] Final Memory: 37M/469M
[INFO] ------------------------------------------------------------------------

Same command was run both times.

mvn install -DskipChecks=true

Then I run mvn clean followed by mvn install -DskipChecks=true, and it’s back.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.063 s
[INFO] Finished at: 2019-03-11T13:41:37-04:00
[INFO] Final Memory: 41M/451M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.2.0:compile (default-compile) on project org.openhab.binding.weathercompany: Compilation failure: Compilation failure:
[ERROR] C:\Users\mark\openhab2-addons\addons\binding\org.openhab.binding.weathercompany\src\main\java\org\openhab\binding\weathercompany\internal\handler\WeatherCompanyHandler.java:[248]
[ERROR] return systemOfUnits instanceof ImperialUnits ? true : false;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Incompatible conditional operand types SystemOfUnits and ImperialUnits

As they say on ESPN, “C’mon man!”

0 Likes

(Mark) #5

@wborn FTR, after I deleted my ~/.m2 directory, the build was consistently successful. I can only assume that there were some corrupted and/or incompatible jar files in there.

0 Likes