I don't think you can add dependencies (mockito-all) from maven like that, it has to be an Eclipse plugin. I tried your example and added the mockito from Eclipse Orbit [1] and
it works. See attached patch.
[1] http://download.eclipse.org/tools/orbit/downloads/ Hope this helps, Marc-Andre From: tycho-user-bounces@xxxxxxxxxxx [tycho-user-bounces@xxxxxxxxxxx] on behalf of Simon Goodall [simon@xxxxxxxxxxxxxxxxxx]
Sent: Monday, 16 March 2015 6:23 PM To: Tycho user list Subject: [tycho-user] Problems running tests with luna platform Hi,
I have been trying to migrate my product from a Indigo base to a Luna base. I have things working in Eclipse, but I am having trouble getting my unit tests to run in Tycho. Specifically I seem to be unable to add Mockito (mockito-all obtained from maven
central) as a dependency to my test project either as a real plugin or a fragment). Removing the mockito dependency allows the test to pass. Tycho reports a fairly vague bundle is not found exception for my test bundle/fragment. However there does appear to
be a number of unresolved capability requirements which I am unsure where they have come from.
Any suggestions on getting this to run? I have attached the error output of the test run and I have uploaded a sample project to github [1]. This can be run with "mvn -X clean integration-test -Pluna"
Thanks,
Simon
|
diff --git a/com.example.plugin.tests/pom.xml b/com.example.plugin.tests/pom.xml index 5deac84..e2aa16c 100644 --- a/com.example.plugin.tests/pom.xml +++ b/com.example.plugin.tests/pom.xml @@ -62,28 +62,27 @@ </configuration> </plugin> - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-surefire-plugin</artifactId> - <version>${tycho.version}</version> - <configuration> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>target-platform-configuration</artifactId> + <configuration> + <dependency-resolution> + <extraRequirements> + <requirement> + <type>eclipse-plugin</type> + <id>org.mockito</id> + <versionRange>0.0.0</versionRange> + </requirement> + <requirement> + <type>eclipse-plugin</type> + <id>org.hamcrest</id> + <versionRange>0.0.0</versionRange> + </requirement> + </extraRequirements> + </dependency-resolution> + </configuration> + </plugin> - <dependencies> - - <dependency> - <type>eclipse-plugin</type> - <artifactId>org.mockito.mockito-all</artifactId> - <version>0.0.0</version> - </dependency> - <dependency> - <type>eclipse-plugin</type> - <artifactId>com.example.plugin</artifactId> - <version>0.0.0</version> - </dependency> - - </dependencies> - </configuration> - </plugin> </plugins> </build> diff --git a/com.example.tests/META-INF/MANIFEST.MF b/com.example.tests/META-INF/MANIFEST.MF index d795aaa..6de5ad1 100644 --- a/com.example.tests/META-INF/MANIFEST.MF +++ b/com.example.tests/META-INF/MANIFEST.MF @@ -4,5 +4,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-SymbolicName: com.example.tests Bundle-Version: 1.0.0.qualifier Require-Bundle: org.junit;bundle-version="4.8.2", - org.mockito.mockito-all;bundle-version="1.9.5" + org.mockito;bundle-version="1.9.5" diff --git a/com.example.tests/pom.xml b/com.example.tests/pom.xml index b89f067..2f741e4 100644 --- a/com.example.tests/pom.xml +++ b/com.example.tests/pom.xml @@ -11,4 +11,29 @@ <artifactId>com.example.tests</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>target-platform-configuration</artifactId> + <configuration> + <dependency-resolution> + <extraRequirements> + <requirement> + <type>eclipse-plugin</type> + <id>org.mockito</id> + <versionRange>0.0.0</versionRange> + </requirement> + <requirement> + <type>eclipse-plugin</type> + <id>org.hamcrest</id> + <versionRange>0.0.0</versionRange> + </requirement> + </extraRequirements> + </dependency-resolution> + </configuration> + </plugin> + </plugins> +</build> + </project> diff --git a/pom.xml b/pom.xml index 4aff073..a66c345 100644 --- a/pom.xml +++ b/pom.xml @@ -16,16 +16,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> - - <dependencies> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - </dependency> - - </dependencies> - <modules> <module>com.example.tests</module> @@ -96,6 +86,14 @@ </plugins> </build> + + <repositories> + <repository> + <id>orbit</id> + <url>http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/</url> + <layout>p2</layout> + </repository> + </repositories> <profiles> <profile> <id>indigo</id> @@ -114,7 +112,7 @@ <id>eclipse-kepler</id> <url>http://download.eclipse.org/releases/kepler/201402280900</url> <layout>p2</layout> - </repository> + </repository> </repositories> </profile> <profile>