Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

junit 4.8 dependency breaks m2e-android integration #662

Closed
peplin opened this issue Oct 16, 2012 · 8 comments
Closed

junit 4.8 dependency breaks m2e-android integration #662

peplin opened this issue Oct 16, 2012 · 8 comments

Comments

@peplin
Copy link

peplin commented Oct 16, 2012

The current master specifies junit-4.10 as a test dependency. When trying to use ActionBarSherlock as an imported Maven project in Eclipse as a both an Eclipse-style project dependency and a Maven-style apklib dependency, I got the infamous:

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/hamcrest/BaseDescription;

This is a known problem with junit 4.10, and it looks like junit 4.11 may fix this. In the meantime, I had to modify ABS's pom to use 4.8 instead so my project would build.

@imminent
Copy link
Contributor

Could you use the tag? You use to have to do that with roboguice
and ABS since they used conflicting compatibility libraries.

@peplin
Copy link
Author

peplin commented Oct 17, 2012

That doesn't work, unfortunately. I changed the dependency to:

<dependency>                                                             
            <groupId>com.actionbarsherlock</groupId>                             
            <artifactId>actionbarsherlock</artifactId>                           
            <version>4.2.0</version>                                             
            <type>apklib</type>                                                  
            <exclusions>                                                         
                <exclusion>                                                      
                    <groupId>junit</groupId>                                     
                    <artifactId>junit</artifactId>                               
                </exclusion>                                                                                                                                                                                                                   
            </exclusions>                                                        
        </dependency>

but this isn't picked up in Eclipse even after refreshing and updating the Maven dependencies. I think this is integrally related to #8 because the junit-4.10.jar dependency actually shows up under "Android Dependencies" and if I unlink my project and ABS in Eclipse, junit goes away.

@JakeWharton
Copy link
Owner

JUnit is a test dependency so it should never be dexed. Maven also correctly knows how to resolve version number conflicts for the same dependency. I don't really see how this is an ABS bug. Seems like Eclipse and/or m2e-eclipse is broken.

@peplin
Copy link
Author

peplin commented Oct 17, 2012

I'm curious to know if anyone else is having this issue. I would be shocked if I was the only one, unless I'm just doing something wrong. Anyone using ABS with Eclipse, Maven and m2e-android successfully?

@imminent
Copy link
Contributor

I can say it's working perfectly with IntelliJ, but I can't answer for Eclipse.

@kevinsawicki
Copy link
Contributor

I don't really see how this is an ABS bug. Seems like Eclipse and/or m2e-eclipse is broken.

You are right, I use ActionBarSherlock from Eclipse fine without using m2e-android. You can just use it as a regular Android project.

@peplin
Copy link
Author

peplin commented Oct 18, 2012

The root cause is definitely a problem with Android library projects and the m2e-android plugin, it's nothing in ABS. This could be closed because the only fix I'm proposing at this point is dropping the junit version back to 4.8 (which works fine in my situation) or bumping it up to 4.11 as soon as that is released (see KentBeck/junit#332).

We still haven't heard from anyone using Android, Eclipse, Maven and the m2e-android plugin to integrate the three projects. I honestly didn't think this was such an odd configuration, that's the only reason for my continued followup here. Thanks!

@peplin
Copy link
Author

peplin commented Oct 18, 2012

Ah, nevermind, I just confirmed it's actually still broken with junit 4.11-beta-1. This is clearly a limitation with m2e-android, so I'll leave ABS out of it. Thanks for the input, everyone.

@peplin peplin closed this as completed Oct 18, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants