Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Issue with getting emails from tycho-user & rephrasing question about unit tests

You seem to be mixing Maven dependencies and OSGi dependencies.  That might work with pomDependencies=consider, but I’ve done my best to avoid this situation entirely:

I instead pull Mockito and Hamcrest from Eclipse Orbit.

But beware Mockito: there are a number of open bug reports on problems with Mockito and Hamcrest.  They boil down to problems due to split packages across org.hamcrest.*, plus incompatible changes made to the Hamcrest API.  You must pull in the org.hamcrest bundle, a facade bundle that pulls in the split packages and re-exports the org.hamcrest package.


> On 5-Apr-2016, at 11:41 AM, David M. Karr <davidmichaelkarr@xxxxxxxxx> wrote:
> In my subscription options for "tycho-user", I have "Receive your own posts to the list?" set to "Yes".  However, I never receive my own posts to this list.  Why is that?
> I asked yesterday about how to get unit tests running in a Tycho-built project.  I'm going to rephrase this with more detail.  I would have responded to my own post, but ...
> In my codebase with a multi-module Maven Tycho build, there are several plugin projects.  I'm trying to add unit tests to one of them, using JUnit and Mockito.
> As I'm not aware of a p2 repo with JUnit or Mockito, I figured I would have to continue using the "maven-dependency-plugin" to get Maven artifacts available for my plugin.  My manifest has "Build-Classpath" entries referring to the "junit" and "mockito-all" jars, which appear to be valid.  This is done in a different plugin, and the plugin with the unit tests depends on that other plugin.
> However, when I run the build, I get the following excerpt from the build (home path elided):
> ----------------------
> [INFO] --- tycho-compiler-plugin:0.24.0:compile (default-compile) @ ---
> [WARNING] The effective compiler target level 1.8 is incompatible with the following OSGi execution environments: [JavaSE-1.7 (assumes 1.7)] @ MavenProject: @ .../git/yangide/plugins/
> [INFO] Compiling 105 source files to .../git/yangide/plugins/
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 32.542 s
> [INFO] Finished at: 2016-04-05T08:32:32-07:00
> [INFO] Final Memory: 109M/603M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.24.0:compile (default-compile) on project Compilation failure: Compilation failure:
> [ERROR] .../git/yangide/plugins/[12]
> [ERROR] import static org.mockito.Mockito.*;
> [ERROR] ^^^^^^^^^^^
> [ERROR] The import org.mockito cannot be resolved
> -----------------
> In non-Eclipse Maven builds, I'm used to seeing Surefire compiling unit tests.  It appears that the "tycho-compiler-plugin" is compiling them here.  I don't know whether that's expected or not.
> I also ran the build with "-X", and this is an excerpt that shows "junit" and "mockito-all" in the dependency tree:
> -------------------
> [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=1, ConflictMarker.nodeCount=230, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=229, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=14, ConflictResolver.conflictItemCount=229, DefaultDependencyCollector.collectTime=7, DefaultDependencyCollector.transformTime=15}
> [DEBUG]    junit:junit:jar:4.12:test
> [DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:test (scope managed from compile by org.opendaylight.odlparent:odlparent:[unknown-version])
> [DEBUG]    org.mockito:mockito-all:jar:1.10.19:test
> [DEBUG] p2.eclipse-plugin:org.eclipse.core.runtime:jar:3.11.1.v20150903-1804:system
> -----------------
> So what might I be doing wrong here?
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top