Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies not copied over to test project #1

Open
laenger opened this issue Jan 21, 2014 · 8 comments
Open

Dependencies not copied over to test project #1

laenger opened this issue Jan 21, 2014 · 8 comments

Comments

@laenger
Copy link

laenger commented Jan 21, 2014

Hi,

I have a test project (':tests.app') and my regular NBS project (':app') next to each other. When running tests using the configuration shown at http://robospock.org/ I get dependency errors that can only be resolved by manually copying over all app dependencies to the test project.

[...]
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':org.example.tests.app:compileTestGroovy'.
[...]
Caused by: java.lang.NoClassDefFoundError: roboguice/activity/RoboActivity
[...]

or

[...]
Could not resolve all dependencies for configuration ':org.example.tests.app:testCompile'.
> Could not find com.android.support:appcompat-v7:19.0.1.
  Required by:
[...]

etc.

I was previously using this plugin: https://github.com/novoda/gradle-android-test-plugin

@pjakubczyk
Copy link
Owner

HI,

thanks for pointing this out. I have just released version 0.2.1 which handles this case.

I know that it will take some time to finalize this plugin :)

Cheers

@laenger
Copy link
Author

laenger commented Jan 22, 2014

Hi,

it's good to see this plugin on its way. Take your time :).

0.2.1 seems to fix basic dependencies. Though, it still doesn't seem to properly handle further dependencies between modules (i.e., the project under test has a dependency to a android-library project). Tests are executed fine when they do not depend on the library-project.

It would also be great to see this plugin being able to directly test projects that use the 'android-library' plugin instead of the 'android' plugin: > Plugin with id android has not been used.

@pjakubczyk
Copy link
Owner

Hi again,

I saw that groovy (java) plugin has completely on idea how to handle project(":androidApp") dependency. Same goes with library. I have already started work on transitive dependencies and I'm almost done.

Should be released today.

Thanks for pointing this out :)

@pjakubczyk
Copy link
Owner

Slipped a bit but released.

I've just pushed 0.3.0 version. It handles the maven/library dependencies. Please drop me if anything else is missing :)

@laenger
Copy link
Author

laenger commented Feb 14, 2014

I finally found some time to test the current plugin version (0.3.1). I can now test my library project :) but I still have dependency problems when testing my android projects. I could reproduce this issue in your sample project:

After adding the appcompat dependency to project android-sample test execution fails.
compile 'com.android.support:appcompat-v7:19.0.1'
To me it seems that dependencies located in the Google repository have to be treated differently.

:robospock-sample:compileTestGroovy

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':robospock-sample:testCompile'.
> Could not find com.android.support:appcompat-v7:19.0.1.
  Required by:
      robospock-plugin:robospock-sample:unspecified

@laenger
Copy link
Author

laenger commented Feb 16, 2014

Adding the following to my robospock project's build.gradle seems to work around the Google dependency problems:

repositories {
    mavenCentral()
    maven { url "${System.env.ANDROID_HOME}/extras/android/m2repository" }
    maven { url "${System.env.ANDROID_HOME}/extras/google/m2repository" }
}

Also, I still need to manually copy over file dependencies to the robospock project, such as

compile files('../libs/volley.jar')

or I run into NoClassDefFoundErrors.

@pjakubczyk
Copy link
Owner

The com.android.support dependency doesn't belong to maven central repository. It's added under hood in the android plugin. That's why it's not visible in the test project even though it's reference is copied.

The hack you made is actually not a hack but the part of android plugin. I think I can add such instructions to robospock plugin to handle this case. I like out of the box solutions.

Coming back to jar issues I did a test and have the same result. I simply add this support soon.

Many thanks for feedback.

@pjakubczyk
Copy link
Owner

Hi Chirstian,

thanks for pointing problems you had. I created issues on github for better
tracking. Nevertheless they are quite easy fixes and I let you know once I
write the code.

#2
#3

Cheers,
Przemek

On Sun, Feb 16, 2014 at 7:35 PM, Christian Langer
notifications@github.comwrote:

Adding the following to my robospock project's build.gradle seems to work
around the Google dependency problems:

repositories {
mavenCentral()
maven { url "${System.env.ANDROID_HOME}/extras/android/m2repository" }
maven { url "${System.env.ANDROID_HOME}/extras/google/m2repository" }
}

Also, I still need to manually copy over file dependencies to the
robospock project, such as

compile files('../libs/volley.jar')

or I run into NoClassDefFoundErrors.

Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-35206181
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants