Managing project dependencies in Eclipse

2019-06-07 05:41发布

I see a number of posts on this, but I'm still struggling.

I've got a workspace with two projects, one with the robotium library and one using it(we'll call this one foo). I would like to click run on foo, and have it re-compile robotium into a jar, add it to foo's build path, and then run foo. How can I do this?

Also, I'm starting to learn maven so I'm not opposed to doing this that way, I just don't know how -- I've been assuming this is something Eclipse can do standalone.

3条回答
放荡不羁爱自由
2楼-- · 2019-06-07 05:59

You can also set an android project as a library, and in the foo project reference to that library.

project properties -> android -> libraries -> add project in workspace

In that way you can have your robotium project with your changes and when you run the foo project it will compile and link the library project, this is also used to separate your project in common libraries, etc.

You will need the Robotium project in your workspace :)

查看更多
做自己的国王
3楼-- · 2019-06-07 06:09

Using maven, you should define the robotium projects as a dependency of your main project. It is also advisable to have a parent pom, where all the projects are defined as modules, including the main project. If you then start a maven build on the parent project, all the modules will be built first.

In this book you can find a well explained step-by-step setup of a maven multimodule project (with downloadable code).

查看更多
叼着烟拽天下
4楼-- · 2019-06-07 06:10

Did you try this in eclipse. Myproject(Foo) > Rightclick > Properties > Java Build Path > Libraries > Add Class Folder (robotium)

查看更多
登录 后发表回答