You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to migrate our repo to bazel, and am running into a rather strange error in unit tests only. The error reproduced below.
I'm using joda-time 2.8.2, which has the DateTime#withTime(LocalTime time) method. When running as a java_binary, the method works just fine. When running as a java_test, the method is missing...
Running bazel run src/main/yunchi:yunchi_bin will work, but running bazel test src/test/yunchi:AllTests will fail with the error below.
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
JUnit4 Test Runner
.E
Time: 0.081
There was 1 failure:
1) testGetDateTime(yunchi.JodaAppTest)
java.lang.NoSuchMethodError: org.joda.time.DateTime.withTime(Lorg/joda/time/LocalTime;)Lorg/joda/time/DateTime;
at yunchi.JodaApp.getDateTime(JodaApp.java:10)
at yunchi.JodaAppTest.testGetDateTime(JodaAppTest.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at com.google.testing.junit.runner.junit4.CancellableRequestFactory$CancellableRunner.run(CancellableRequestFactory.java:90)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
at com.google.testing.junit.runner.junit4.JUnit4Runner.run(JUnit4Runner.java:114)
at com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:152)
at com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:91)
FAILURES!!!
Tests run: 1, Failures: 1
BazelTestRunner exiting with a return value of 1
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.
-- JVM shutdown starting at 2016-08-18 11:22:14 --
The text was updated successfully, but these errors were encountered:
mightyguava
changed the title
Bazel unit tests using wrong version of joda-time
Unit tests using wrong version of joda-time with bazel
Aug 18, 2016
@ulfjack I saw you are working on the Bazel Java Test Runner. Do you mind taking a look at this issue? I'm reasonably convinced it's due to the Bazel test runner not shading its dependencies.
Hi,
I'm trying to migrate our repo to bazel, and am running into a rather strange error in unit tests only. The error reproduced below.
I'm using joda-time 2.8.2, which has the
DateTime#withTime(LocalTime time)
method. When running as ajava_binary
, the method works just fine. When running as ajava_test
, the method is missing...I suspect that the unit test deploy jar is overriding my joda_time dependency with bazel's own, specifically this one right here! https://github.com/bazelbuild/bazel/blob/master/third_party/joda_time/joda-time-2.3.jar
A minimal repro case is here https://github.com/mightyguava/bazeldatetime.
Running
bazel run src/main/yunchi:yunchi_bin
will work, but runningbazel test src/test/yunchi:AllTests
will fail with the error below.The text was updated successfully, but these errors were encountered: