= Build and Test DeltaSpike from Source

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

The DeltaSpike source (modules and examples) is provided for inspection, contribution and testing purposes. The source must be built with Maven, which has been used to automate the compilation, testing and packaging processes. Arquillian tests are included with the source and a CDI implementation or container can be specified with which to carry out the tests.

In all cases, to obtain the DeltaSpike source, link:https://deltaspike.apache.org/download.html[download] `deltaspike-project-{latestStable}-source-release.zip` and extract the contents.
	
NOTE: You can also obtain the DeltaSpike source from the project Git repository. The repository is subject to change and it can be used for contributing but should not be used in production environments. For more information, see <<source#,Contribute to the DeltaSpike Source>>. 

== Build without CDI Implementation Tests
DeltaSpike can be built without executing tests against a CDI implementation, with the following commands:

[source,shell,subs="+attributes"]
----
$ cd /path/to/deltaspike-project-{latestStable}/
$ mvn clean install
----

== Build and Test with a CDI Implementation
Tests can be executed with both the JBoss Weld and Apache OpenWebBeans CDI implementations. 

[cols="1,2a", options="header"]
.Build Tests
|===
|Container |Command to Execute Arquillian Tests

|JBoss Weld 1.x (CDI 1.0)
|
[source,shell]
----
$ mvn clean install -PWeld1 -Dweld.version=1.1.33.Final
----

|JBoss Weld 2.x (CDI 1.2)
|
[source,shell]
----
$ mvn clean install -PWeld2 -Dweld.version=2.3.4.Final
----

|JBoss Weld 3.x (CDI 2.0)
|
[source,shell]
----
$ mvn clean install -PWeld3 -Dweld.version=3.0.0.Alpha16
----

|Apache OpenWebBeans
|
[source,shell]
----
$ mvn clean install -POWB
----
|===

== Build and Test with a CDI Container
Tests can be executed with JBoss Weld and Apache OpenWebBeans through Java EE 6+ application servers and containers. Configurations are currently provided as details in the table here. 

[cols="2,3a", options="header"]
.Integration Tests
|===
|Container |Command to Execute Arquillian Tests

|Apache TomEE
|
[source,shell]
----
$ mvn clean install -Ptomee-build-managed
----

|JBoss AS7 (without AS7 installation)
|
[source,shell]
----
$ mvn clean install -Pjbossas-build-managed-7
----

|JBoss AS7 (AS7 installation required)
|Set `JBoss_HOME`

[source,shell]
----
$ mvn clean install -Pjbossas-managed-7 
----

|JBoss WildFly 8 (without WildFly 8 installation)
|
[source,shell]
----
mvn clean install -Pwildfly-build-managed
----

|JBoss WildFly 8 (WildFly 8 installation required)
|Set `WILDFLY_HOME`

[source,shell]
----
$ mvn clean install -Pwildfly-managed
----

|Oracle GlassFish 3 (without GlassFish 3 installation)
|
[source,shell]
----
mvn clean install -Pglassfish-build-managed-3
----

|Oracle GlassFish 3.1 (GlassFish 3.1 installation required)
|Install GlassFish (default setup without admin-password) and start
GlassFish with `asadmin start-domain` and `asadmin start-database`.

[source,shell]
----
$ mvn clean install -Pglassfish-remote-3.1
----

|Oracle GlassFish 4 (without Oracle GlassFish 4 installation)
|
[source,shell]
----
mvn clean install -Pglassfish-build-managed-4
----

|Oracle WebLogic 12c
|Install WebLogic 12c. Start Configuration Wizard to create a new basic
WebLogic Domain. Default options and domain name = base_domain,
administrator user name = weblogic1, administrator password = weblogic1.
Set `WLS_HOME` so that `%WLS_HOME%.jar` exists. Start the domain.

[source,shell]
----
$ mvn clean install -Pwls-remote-12c
----
|===

== Build and Debug with a Java EE6+ application servers
Tests can be debugged through Java EE 6+ application servers. Configurations are currently provided as details in the table here.

[cols="2,3a", options="header"]
.Integration Tests with debug
|===
|Container |Command to Execute Arquillian Tests with remote debugging

|Apache TomEE
|Use remote debuggig at port 5005

[source,shell]
----
mvn test -Ptomee-build-managed -Dtest=UnitTestName -Dopenejb.server.debug=true
----

|===

== Next
* For analysis of the DeltaSpike source, see https://analysis.apache.org/dashboard/index/org.apache.deltaspike:deltaspike-project
* For information about DeltaSpike automated Jenkins builds, see https://builds.apache.org/view/A-D/view/DeltaSpike/

