Permalink
Fetching contributors…
Cannot retrieve contributors at this time
386 lines (348 sloc) 21 KB

WildFly Swarm addon for JBoss Forge

Build Status License Maven Central

This addon provides standalone functionality, and exports services for use in other addons.

Installation

From Forge CLI:

addon-install-from-git --url https://github.com/forge/wildfly-swarm-addon.git

Depends on

Addon Exported Optional

ui

yes

no

projects

yes

no

maven

yes

no

Features

WildFly Swarm Project type

If you are creating a new project, you can choose the wildfly-swarm project type directly

[tmp]$ project-new --named demo --type wildfly-swarm --stack JAVA_EE_7
***SUCCESS*** Project named 'demo' has been created.
***SUCCESS*** Stack 'Java EE 7' installed in project
***SUCCESS*** WildFly Swarm is now set up! Enjoy!
Setup command

If you’re working in an existing project (or you forgot to choose wildfly-swarm in the command above) just type wildfly-swarm-setup if you’re in shell. It should read WildFly-Swarm: Setup if you’re in a GUI environment:

wildfly-swarm-setup

And that’s it! The wildfly-swarm-maven plugin will be installed.

Add Fraction

You can install Wildfly Swarm Fractions by using the command wildfly-swarm-add-fraction:

[demo]$ wildfly-swarm-add-fraction --fractions
archaius             camel-jaxb           cdi-ext              hystrix              jaxrs-validator      keycloak             microprofile         remoting             topology-consul
arquillian-daemon    camel-jms            datasources          infinispan           jca                  keycloak-server      mod_cluster          resource-adapters    topology-jgroups
batch-jberet         camel-jmx            drools-server        javafx               jdr                  logging              monitor              ribbon               topology-openshift
bean-validation      camel-jpa            ejb                  jaxrs                jgroups              logstash             mysql                ribbon-secured       topology-webapp
camel-cdi            camel-mail           ejb-remote           jaxrs-cdi            jmx                  mail                 netflix-guava        servo                transactions
camel-core           camel-other          h2                   jaxrs-jaxb           jolokia              management           netflix-rxjava       spring               undertow
camel-cxf            camel-undertow       hibernate-search     jaxrs-jsonp          jpa                  management-console   netflix-rxnetty      swagger              vertx
camel-ejb            cdi                  hibernate-validator  jaxrs-multipart      jsf                  messaging            postgresql           swagger-webapp       webservices

You can choose any fraction you want to install. Installed fractions are not listed.

Detect Fractions

This will run a fraction analyzer algorithm and list the missing fractions. You can add them to your project by specifying the --depend parameter

[demo]$ rest-new-endpoint --named MyEndpoint
***SUCCESS*** JAX-RS has been installed.
***SUCCESS*** REST org.demo.rest.MyEndpoint was created

[MyEndpoint.java]$ wildfly-swarm-detect-fractions --depend --build
***INFO*** Detecting fractions 	[1/3] ...
***INFO*** Building the project... 	[1/3] ...
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building newdemo 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ newdemo ---
[INFO] Deleting /tmp/newdemo/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ newdemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ newdemo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /tmp/newdemo/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ newdemo ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ newdemo ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ newdemo ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ newdemo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [newdemo] in [/tmp/newdemo/target/newdemo]
[INFO] Processing war project
[INFO] Copying webapp resources [/tmp/newdemo/src/main/webapp]
[INFO] Webapp assembled in [35 msecs]
[INFO] Building war: /tmp/newdemo/target/newdemo.war
[INFO]
[INFO] --- wildfly-swarm-plugin:2016.9:package (default) @ newdemo ---
[INFO] Scanning for needed WildFly Swarm fractions with mode: when_missing
[INFO] Detected fractions: jaxrs:2016.9
[INFO] Adding fractions: container:2016.9, ee:2016.9, io:2016.9, jaxrs:2016.9, logging:2016.9, naming:2016.9, request-controller:2016.9, security:2016.9, undertow:2016.9
[INFO] Repackaging .war: /tmp/newdemo/target/newdemo.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ newdemo ---
[INFO] Installing /tmp/newdemo/target/newdemo.war to /home/ggastald/.m2/repository/org/newdemo/newdemo/1.0.0-SNAPSHOT/newdemo-1.0.0-SNAPSHOT.war
[INFO] Installing /tmp/newdemo/pom.xml to /home/ggastald/.m2/repository/org/newdemo/newdemo/1.0.0-SNAPSHOT/newdemo-1.0.0-SNAPSHOT.pom
[INFO] Installing /tmp/newdemo/target/newdemo-swarm.jar to /home/ggastald/.m2/repository/org/newdemo/newdemo/1.0.0-SNAPSHOT/newdemo-1.0.0-SNAPSHOT-swarm.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.801 s
[INFO] Finished at: 2016-09-06T15:37:52-03:00
[INFO] Final Memory: 61M/809M
[INFO] ------------------------------------------------------------------------
***INFO*** Detected fractions: [org.wildfly.swarm:jaxrs:2016.9]
***INFO*** Adding missing fractions as project dependencies... 	[3/3] ...
***INFO*** Installing the following dependencies: [org.wildfly.swarm:jaxrs:2016.9]
List Fractions

This will list all the available fractions

[MyEndpoint.java]$ wildfly-swarm-list-fractions
arquillian-daemon: Arquillian Daemon (Arquillian Daemon)
batch-jberet: Batch (Java EE Batch with JBeret)
bean-validation: Bean Validation (Define constraints on object models with annotations)
camel-cdi: Camel CDI (Camel)
camel-core: Camel (Camel)
camel-cxf: Camel CXF (Camel)
camel-ejb: Camel EJB (Camel)
camel-jaxb: Camel JAXB (Camel)
camel-jms: Camel JMS (Camel)
camel-jmx: Camel JMX (Camel)
camel-jpa: Camel JPA (Camel)
camel-mail: Camel Mail (Camel)
camel-other: Camel Other (Camel)
camel-undertow: Camel Undertow (Camel)
cdi: CDI (CDI with Weld)
cdi-ext: CDI Extensions (CDI Extensions)
connector: Connector (Connector)
container: Container (Container)
datasources: Datasources (Datasources for installing database drivers, etc)
drools-server: Drools Server (Drools Server)
ee: EE (EE)
ejb: EJB (Use EJBs in your application)
ejb-remote: EJB Remote (Access EJBs in remote containers)
h2: H2 (H2 driver and datasource)
hibernate-search: Hibernate Search (Hibernate Search transparently indexes your objects and offers fast regular, full-text and geolocation search. Ease of use and easy clustering are core.)
hibernate-validator: Hibernate Validator (Validation annotations going beyond Bean Validation)
hystrix: Hystrix (Latency and Fault Tolerance, such as Circuit Breaker, with Hystrix from Netflix OSS)
infinispan: Infinispan (Distributed in-memory key/value store)
io: IO (IO)
javafx: JavaFX (For using JavaFX classes in your application.)
jaxrs: JAX-RS (RESTful Web Services with RESTEasy)
jaxrs-cdi: JAX-RS with CDI (Provide CDI injection into RESTful services)
jaxrs-jaxb: JAX-RS with JAXB (Add JAXB binding support for RESTful services)
jaxrs-jsonp: JAX-RS with JSON-P (Enable JSON-P interchange format for RESTful services)
jaxrs-multipart: JAX-RS with Multipart (Multipart support for RESTful services)
jaxrs-validator: JAX-RS with Validation (Validation support for RESTful services)
jca: JCA (Java EE Connector Architecture)
jdr: JBoss Diagnostic Reporting (Enables the gathering of diagnostic data for use in remote analysis of error conditions. Although the data is in a simple format and could be useful to anyone, primarily useful for JBoss EAP subscribers who would provide the data to Red Hat when requesting support)
jgroups: JGroups (Reliable messaging for creating a cluster)
jgroups-module: JGroups replacement module (JGroups replacement module)
jmx: JMX (Expose resources as MBeans)
jolokia: Jolokia (Deploys the jolokia.war to activate JMX-HTTP bridge as an alternative to JSR-160 connectors)
jpa: JPA (Java Persistence API with Hibernate and H2 datasource)
jsf: JSF (Java Server Faces for developing UIs)
keycloak: Keycloak (Securing your RESTful services)
keycloak-server: Keycloak Server (Running Keycloak in an uber jar)
logging: Logging (Customizing the Logging for WildFly)
logstash: Logstash (Write log entries to Logstash for use in ELK stack)
mail: Mail (Java Mail API for messaging)
management: Management (Enables WildFly management capabilities)
management-console: Management Console (UI to manage a running WildFly/Swarm server)
messaging: Messaging (JMS Messaging with ActiveMQ)
microprofile: MicroProfile (Implementation of MicroProfile.io)
mod_cluster: Modcluster (Modcluster support)
monitor: Monitor (Health endpoints for your application)
msc: MSC (WildFly Swarm: MSC)
mysql: MySQL (MySQL driver and datasource)
naming: Naming (WildFly Swarm: Naming)
netflix-guava: null (null)
netflix-rxjava: null (null)
netflix-rxnetty: null (null)
postgresql: PostgreSQL (PostgreSQL driver and datasource)
remoting: Remoting (Connecting to remote containers)
request-controller: Request Controller (Request Controller)
resource-adapters: Resource Adapters (Resource Adapters deployed with .rar files)
ribbon: Ribbon (Client side load balancing with Netflix Ribbon)
ribbon-secured: Ribbon Secured (Provides security token propagation across invocations when using Netflix Ribbon and Keycloak)
security: Security (Security)
servo: null (null)
spring: Spring WebMVC (RESTful services with Spring WebMVC)
swagger: Swagger (Generate swagger.json for all JAX-RS endpoints in your application)
swagger-webapp: Swagger Webapp (UI for Swagger to visualize the generated swagger.json)
topology: Topology (Topology)
topology-consul: Hashicorp Consul (Service Discovery with Hashicorp Consul)
topology-jgroups: JGroups (Utilizes JGroups as a Service Registry that is discoverable)
topology-openshift: OpenShift (Service Discovery with OpenShift)
topology-webapp: Topology UI (Server-Sent Events of instances being added/removed from cluster)
transactions: Transactions (JTA distributed transactions with Narayana)
undertow: Undertow (Servlet Container with Undertow)
vertx: Vert.x (Deploys the Vert.x JCA Adapter)
webservices: Web Services (Web Services with CXF)
Change Version

Changes the WildFly Swarm version in the addon. Subsequent project creation using the project-new command would use the version specified by this command instead. The permanent flag will add a swarm.version property in your ~/.forge/config.properties file and will use that version permanently.

Important
This command does not perform any change to the current project.
Create Main Class

Creates a Java Class with a main() method containing some basic code to boot Swarm and configure it in the swarm maven plugin.

[MyEndpoint.java]$ wildfly-swarm-new-main-class
***SUCCESS*** Main Class org.demo.Main was created
[Main.java]$ cat -c .
package org.demo;

import org.wildfly.swarm.Swarm;

public class Main {

	public static void main(String[] args) throws Exception {
		Swarm swarm = new Swarm();
		swarm.start();
		swarm.deploy();
	}
}
Create Test Class

Creates a Java Test Class and adds Arquillian WildFly Swarm dependency. This test uses the @DefaultDeployment deployment approach and in case of specifying the flag asClient it also enriches your test with current URL.

wildfly-swarm-new-test --target-package org.example.rest --named HelloWorldEndpointTest
***SUCCESS*** Test Class org.example.rest.HelloWorldEndpointTest was created
[HelloSwarm]$ cd src/test/java/org/example/rest/HelloWorldEndpointTest.java
[HelloWorldEndpointTest.java]$ cat -c .
package org.example.rest;

import org.junit.runner.RunWith;
import org.jboss.arquillian.junit.Arquillian;
import org.wildfly.swarm.arquillian.DefaultDeployment;
import org.junit.Test;

@RunWith(Arquillian.class)
@DefaultDeployment
public class HelloWorldEndpointTest {

	@Test
	public void should_start_service() {
	}
}
Run

Builds and executes the current swarmed project (in command line mode only so far) and will block the UI until Ctrl+C is pressed.

[Main.java]$ wildfly-swarm-run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building newdemo 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> wildfly-swarm-plugin:2016.9:run (default-cli) > package @ newdemo >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ newdemo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ newdemo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /tmp/newdemo/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ newdemo ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ newdemo ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ newdemo ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ newdemo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [newdemo] in [/tmp/newdemo/target/newdemo]
[INFO] Processing war project
[INFO] Copying webapp resources [/tmp/newdemo/src/main/webapp]
[INFO] Webapp assembled in [35 msecs]
[INFO] Building war: /tmp/newdemo/target/newdemo.war
[INFO]
[INFO] --- wildfly-swarm-plugin:2016.9:package (default) @ newdemo ---
[INFO] Scanning for needed WildFly Swarm fractions with mode: when_missing
[INFO] Detected fractions: jaxrs:2016.9
[INFO] Adding fractions: container:2016.9, ee:2016.9, io:2016.9, jaxrs:2016.9, logging:2016.9, naming:2016.9, request-controller:2016.9, security:2016.9, undertow:2016.9
[INFO] Repackaging .war: /tmp/newdemo/target/newdemo.war
[INFO]
[INFO] <<< wildfly-swarm-plugin:2016.9:run (default-cli) < package @ newdemo <<<
[INFO]
[INFO] --- wildfly-swarm-plugin:2016.9:run (default-cli) @ newdemo ---
[INFO] Starting .war
[INFO] Scanning for needed WildFly Swarm fractions with mode: when_missing
[INFO] Detected fractions: jaxrs:2016.9
[INFO] Using fractions: container:2016.9, ee:2016.9, io:2016.9, jaxrs:2016.9, logging:2016.9, naming:2016.9, request-controller:2016.9, security:2016.9, undertow:2016.9
Dependencies not bundled, will resolve from local M2REPO
15:35:32,470 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                Container - STABLE          org.wildfly.swarm:container:2016.9
15:35:32,487 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                  Logging - STABLE          org.wildfly.swarm:logging:2016.9
15:35:32,487 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                       IO - STABLE          org.wildfly.swarm:io:2016.9
15:35:32,488 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                   Naming - STABLE          org.wildfly.swarm:naming:2016.9
15:35:32,488 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:       Request Controller - STABLE          org.wildfly.swarm:request-controller:2016.9
15:35:32,488 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                       EE - STABLE          org.wildfly.swarm:ee:2016.9
15:35:32,488 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                 Security - STABLE          org.wildfly.swarm:security:2016.9
15:35:32,489 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                 Undertow - STABLE          org.wildfly.swarm:undertow:2016.9
15:35:32,489 INFO  [org.wildfly.swarm] (main) WFSWARM0018: Installed fraction:                   JAX-RS - STABLE          org.wildfly.swarm:jaxrs:2016.9
15:35:32,521 INFO  [org.jboss.weld.Version] (main) WELD-000900: 3.0.0 (Alpha16)
15:35:32,544 INFO  [org.jboss.weld.Bootstrap] (main) WELD-ENV-000020: Using jandex for bean discovery
15:35:32,739 INFO  [org.jboss.weld.Bootstrap] (main) WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
15:35:32,787 WARN  [org.jboss.weld.Interceptor] (main) WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
15:35:32,788 WARN  [org.jboss.weld.Interceptor] (main) WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
15:35:33,402 INFO  [org.jboss.weld.Bootstrap] (main) WELD-ENV-002003: Weld SE container STATIC_INSTANCE initialized
15:35:33,919 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
15:35:34,004 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Swarm 2016.9 (WildFly Core 2.2.0.Final) starting
15:35:34,034 INFO  [org.wildfly.swarm] (MSC service thread 1-6) WFSWARM0029: Install MSC service for command line args: []
2016-09-06 15:35:34,492 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 12) WFLYSEC0002: Activating Security Subsystem
2016-09-06 15:35:34,494 INFO  [org.jboss.as.security] (MSC service thread 1-4) WFLYSEC0001: Current PicketBox version=4.9.6.Final
2016-09-06 15:35:34,499 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0003: Undertow 1.4.0.Final starting
2016-09-06 15:35:34,500 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 14) WFLYNAM0001: Activating Naming Subsystem
2016-09-06 15:35:34,528 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 16) WFLYIO001: Worker 'default' has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
2016-09-06 15:35:34,599 INFO  [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service
2016-09-06 15:35:34,650 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.4.0.Final
2016-09-06 15:35:34,664 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.4.0.Final
2016-09-06 15:35:34,731 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0012: Started server default-server.
2016-09-06 15:35:34,808 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on [0:0:0:0:0:0:0:0]:8080
2016-09-06 15:35:34,913 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Swarm 2016.9 (WildFly Core 2.2.0.Final) started in 1036ms - Started 68 of 76 services (15 services are lazy, passive or on-demand)
2016-09-06 15:35:35,448 INFO  [org.wildfly.swarm.runtime.deployer] (main) deploying newdemo.war
2016-09-06 15:35:35,486 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "newdemo.war" (runtime-name: "newdemo.war")
2016-09-06 15:35:35,854 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0018: Host default-host starting
2016-09-06 15:35:36,116 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 6) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.newdemo.rest.RestApplication
2016-09-06 15:35:36,136 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 6) WFLYUT0021: Registered web context: /
2016-09-06 15:35:36,162 INFO  [org.jboss.as.server] (main) WFLYSRV0010: Deployed "newdemo.war" (runtime-name : "newdemo.war")