I'm using Eclipse RCP to write a GUI which would use Spring framework related projects, such as:
So my question is how to add this dependencies elegantly ? (Spring does not support osgi for a long time, there are many other ways which are very complicated and tedious)
I've found a good Solution to solve this problem. It will use following skills: Maven , Eclipse Plugin
The steps are:
first, write the pom.xml which contains the dependencies you want, for example: spring-websocket
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency>
then, you need to download all websocket jars, you need to use maven command to help you to do that :), the jars are all in /target folder by default
mvn dependency:copy-dependencies
Note: maven will handle the dependency tree.
next, in Eclipse create a "Plug-in from Existing JAR Archives" project and import these jars
Note: Un-check the "Upzip the JAR archives into the project". (Or all jars will be decompressed into folder and files then stored in the project)
finally, add this plugin project in your main RCP project as a dependency . And you can write/run your websocket client now!
Hope this is an elegant way to solve this problem.
There are different ways to convert maven artifacts to OSGi bundles:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.