Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to an OSGi plugin that can run out of eclipse workspace #530

Closed
wants to merge 1 commit into from

Conversation

ddumont
Copy link

@ddumont ddumont commented Aug 13, 2014

Here you guys go. In case you want it. I've found it quite useful deployed in eclipse along side my rest application.

@fehguy
Copy link
Contributor

fehguy commented Aug 14, 2014

Hi @ddumont this is cool. Can you elaborate a bit more on how one would use this in the development/deployment process? I have to say I'm a bit dated in the eclipse world.

@ddumont
Copy link
Author

ddumont commented Aug 29, 2014

Sure! Most of what I do is based on eclipse bundles. Usually I deploy to a karaf server, but when I'm testing and developing, it's really easy to do that development/running/testing/reloading all within eclipse.

Eclipse now-a-days comes with jetty which you can start up and register servlets, resources, filters, etc with. You can be barebones or elaborate. In my case, I have:

  • jetty
  • jax-rs
  • jersey
  • guice
  • shiro
  • pax-web

all playing nice together. This means that when I start up the osgi run config for my project, my local dev environment loads the servlets related to my project all together. With this change (adding a manifest for eclipse to find, and a plugin.xml to register the resources), eclipse can tell jetty to serve up the swagger-ui files on the same domain / port / protocol as the rest of my stuff. It makes it really great to use swagger for documentation and reference purposes!

After loading the project in eclipse, create a new OSGi Framework run config:
image

Tell eclipse to load swagger out of your workspace, and then search for and check the jetty bundles in your eclipse environment. Then just click the Add Required Bundles button. It will likely give you more than you need. I've pruned back the run config above to the bare minimum you'll need to actually serve the files, though you do get some console message about not being able to find certain bundles.

OSGi can be painful like that sometimes. If you want to play whack-a-mole and load the deps to get rid of the errors, that goes beyond the bootstrap to get it working for you :)

Also: in the run config on the Arguments tab, you should add this to VM Arguments to have jetty start on 80 if you want instead of its default port
-Dorg.osgi.service.http.port=80

@fehguy fehguy added this to the future milestone Jan 29, 2015
@webron
Copy link
Contributor

webron commented Jan 29, 2015

We're probably gonna handle various packaging options for languages/frameworks in the future, and it would fit with those if/when/once it's done.

@fehguy
Copy link
Contributor

fehguy commented Mar 27, 2015

I think the right approach is to start a new project which wraps swagger-ui. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants