[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
[tycho-user] Issue with getting emails from tycho-user & rephrasing question about unit tests
 | 
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) @ 
com.cisco.yangide.ext.model.editor ---
[WARNING] The effective compiler target level 1.8 is incompatible with 
the following OSGi execution environments: [JavaSE-1.7 (assumes 1.7)] @ 
MavenProject: 
org.opendaylight.yangide:com.cisco.yangide.ext.model.editor:1.1.1-SNAPSHOT 
@ .../git/yangide/plugins/com.cisco.yangide.ext.model.editor/pom.xml
[INFO] Compiling 105 source files to 
.../git/yangide/plugins/com.cisco.yangide.ext.model.editor/target/classes
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[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 com.cisco.yangide.ext.model.editor: Compilation failure: 
Compilation failure:
[ERROR] 
.../git/yangide/plugins/com.cisco.yangide.ext.model.editor/src/test/java/com/cisco/yangide/ext/model/editor/YinBuilderTest.java:[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] 
org.opendaylight.yangide:com.cisco.yangide.ext.model.editor:eclipse-plugin:1.1.1-SNAPSHOT
[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?