I'm new to IntelliJ and Java but I have a fair bit of TeamCity experience, mostly building .Net projects.
I have created a very simple Android Library project in IntelliJ with basically a single class that uses RxJava (Reactive Extensions for Java). I have added the Rx library in IntelliJ using Project Structure -> Libraries -> From Maven. The actual library I have added is com.netflix.rxjava:rxjava-android:0.19.6
which pulls in com.netflix.rxjava:rxjava-core:0.19.6
.
This works brilliantly and my project compiles within IntelliJ without even having to install Maven. Nice job, JetBrains.
However, when I try to build the project in TeamCity using the IntelliJ-IDEA runner, the project doesn't compile. Bad JetBrains!
I get errors on all the references to rx.*
, which as I said all worked perfectly on my workstation. The errors from TeamCity look like this:
C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:3: package rx does not exist import rx.Observable; ^ C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:4: package rx.subjects does not exist import rx.subjects.BehaviorSubject; ^ C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:18: cannot find symbol symbol: class BehaviorSubject location: class com.example.TigraAndroidUtilities.ObservableModel private BehaviorSubject modelStream; ^ C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:63: cannot find symbol symbol: class Observable location: class com.example.TigraAndroidUtilities.ObservableModel public Observable toObservable() ^ C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:28: cannot find symbol symbol: variable BehaviorSubject location: class com.example.TigraAndroidUtilities.ObservableModel modelStream = BehaviorSubject.create(modelData); ^ C:\BuildAgent\work\eefd62e2c3082b56\src\com\example\TigraAndroidUtilities\ObservableModel.java:65: cannot find symbol symbol: variable Observable location: class com.example.TigraAndroidUtilities.ObservableModel if (completed) { return Observable.empty(); } ^
Here's what I've tried:
- Considered using the Maven build runner instead; but the project doesn't have a POM file so it's not a Maven build.
- I've tried installing Maven on the build agent, that doesn't seem to make any difference and I didn't need to install it for IntelliJ to work locally so I can't see why it would be needed.
- There is a path macro called MAVEN_REPOSITORY in the IntelliJ build runner settings and I've tried setting that to various different values, no luck.
- I've looked at JetBrains' documentation for the IntelliJ runner and as far as I can tell, I've configured my build step correctly. Clearly I'm missing something though.
This is all a bit frustrating, I've been tinkering with it hours but nothing seems to work and basically I have no clue what I'm doing wrong. I must have missed something somewhere. How can I get this build working properly in TeamCity?