An open API service indexing awesome lists of open source software.

https://github.com/dharmit/wildfly-swarm-with-che

Simple WildFly Swarm example to run on Eclipse Che. Taken from
https://github.com/dharmit/wildfly-swarm-with-che

Last synced: 12 months ago
JSON representation

Simple WildFly Swarm example to run on Eclipse Che. Taken from

Awesome Lists containing this project

README

          

# JAX-RS .war With Swagger Enabled Example

This example takes a normal JAX-RS build, and wraps it into
a `-swarm` runnable jar with `swagger` enabled on the resources.

> Please raise any issues found with this example in our JIRA:
> https://issues.jboss.org/browse/SWARM

## Project `pom.xml`

This project is a traditional JAX-RS project, with maven packaging
of `war` in the `pom.xml`

war

The project adds a `` to configure `wildfly-swarm-plugin` to
create the runnable `.jar`.


org.wildfly.swarm
wildfly-swarm-plugin
${version.wildfly-swarm}



package



To define the needed parts of WildFly Swarm, a dependency is added


org.wildfly.swarm
jaxrs
${version.wildfly-swarm}

This dependency provides the JAX-RS APIs to your application, so the
project does *not* need to specify those.

To enable the `swagger` fraction, another dependency is added


org.wildfly.swarm
swagger
${version.wildfly-swarm}

This dependency will cause the WildFly Swarm `swagger` fraction to
enable swagger with zero configuration. You can browse the swagger.json
at http://localhost:8080/swagger.json.

Additional application dependencies (in this case `joda-time`) can be
specified and will be included in the normal `.war` construction and available
within the WildFly Swarm application `.jar`.

## Run

* mvn package && java -jar ./target/example-jaxrs-war-swarm.jar
* mvn wildfly-swarm:run
* From your IDE, run class `org.wildfly.swarm.Swarm`

## Use

Since WildFly Swarm apps tend to support one deployment per executable, it
automatically adds a `jboss-web.xml` to the deployment if it doesn't already
exist. This is used to bind the deployment to the root of the web-server,
instead of using the `.war`'s own name as the application context.

http://localhost:8080/

Be aware that you will notice an exception in the logs when accessing the page.
This is simply an overly verbose message from WildFly that the 'favicon.ico' file couldn't be found.