Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Is it possible to add mockito as a maven dependency to a test plugin?

It is possible to add Mockito and Hamcrest as dependencies to a test plug-in. The easiest way to do it is:

  1. Create a target platform that defines your development environment [1]. Use the Orbit update site to add JUnit, Mockito and Hamcrest to the target platform.
  2. Create your test plug-in and add JUnit, Mockito and Hamcrest to its dependencies.
  3. Configure your Tycho build and ask it to rely on the target platform [2], so that JUnit, Mockito and Hamcrest are known at compile-time.
  4. Run mvn verify

Alternatively, if you want to rely on artifacts from Maven Central that are not available from an update site you can also wrap the JAR as an OSGi bundle [3] or ask Tycho to create a new OSGi bundle dynamically [4].

[1] https://www.vogella.com/tutorials/EclipseTargetPlatform/article.html
[2] https://www.vogella.com/tutorials/EclipseTycho/article.html#defining-the-dependencies-for-the-build
[3] https://www.vogella.com/tutorials/EclipseJarToPlugin/article.html
[4] https://flames-of-code.netlify.com/blog/maven-and-tycho-deps/

Le 16/08/2019 à 17:49, Steinar Bang a écrit :
Mickael Istria <mistria@xxxxxxxxxx>:
On Thursday, August 15, 2019, Steinar Bang <sb@xxxxxx> wrote:
Is it possible to add mockito and hamcrest as maven dependencies to a
test plugin project built with tycho[1]?

Use the Orbit p2 repo to get those artifacts in a p2/Tycho-friendly way:
https://download.eclipse.org/tools/orbit/downloads/drops/R20190602212107/repository
In other words: No it isn't possible...? :-)

That's a pity, it would have simplified things a lot, if I could have
used artifacts from maven central (provided that they are OSGi bundles,
of course...).

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tycho-user

Back to the top