<properties>
<deltaspike.version>1.9.4</deltaspike.version>
</properties>
DeltaSpike is available for use in projects of many build tools. Instructions are given here for obtaining released final versions of DeltaSpike for both approaches.
You can also opt to use the lastest DeltaSpike snapshots; for more information, see Use DeltaSpike Snapshots. |
DeltaSpike released versions are available from the Maven Central repository for use in Maven-based projects. This means that you do not need to modify your Maven configuration settings.xml
file; when building projects, Maven automatically searches the online Maven Central repository for project dependencies and downloads sources to your local Maven repository.
To begin use the DeltaSpike releases from Maven Central, you simply need to configure the project pom.xml
file for each project with information about the release version and modules you want to use. At a minimum, you must add the DeltaSpike Core module, which provides the DeltaSpike API and utility classes.
Open the project pom.xml
file for editing
Add the DeltaSpike version to the list of properties
<properties>
<deltaspike.version>1.9.4</deltaspike.version>
</properties>
Add the DeltaSpike Core module to the list of dependencies
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.deltaspike.distribution</groupId>
<artifactId>distributions-bom</artifactId>
<version>${deltaspike.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<scope>runtime</scope>
</dependency>
Save the pom.xml
file changes
The API is scoped for compile time and implementation only included for runtime, assisting to prevent you from inadvertently depending on an implementation class. |
For instructions on adding the optional DeltaSpike modules, see the relevant module page:
Setting up DeltaSpike in a Gradle based project is just as easy as Maven.
// setup the Spring Dependency Management Plugin for Gradle, to import BOMs.
plugins {
id "io.spring.dependency-management" version "0.5.6.RELEASE"
id "java" // you'll likely also want the WAR plugin
}
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'org.apache.deltaspike.distribution:distributions-bom:1.9.4'
}
}
dependencies {
compile 'org.apache.deltaspike.core:deltaspike-core-api'
runtime 'org.apache.deltaspike.core:deltaspike-core-impl'
}
sourceSets {
main {
//To use standard bean discovery mechanisms, CDI expects beans.xml to be in your classes directory
output.resourcesDir = output.classesDir
}
test {
output.resourcesDir = output.classesDir
} // and any other sourceSet you might have.
}
This will give you a Gradle build setup to run DeltaSpike.
DeltaSpike is provided as a set of downloadable .jar files for projects not utilizing the Maven build system. Alternatively, you can build the DeltaSpike .jar files from source; for instructions, see Build DeltaSpike from Source. In both cases, you must add the DeltaSpike .jar files directly to your projects.
To use DeltaSpike without Maven from the downloadable .jar files, complete the following steps:
Download the latest distribution-full-<version>.zip
from https://deltaspike.apache.org/download.html
Extract the archive contents
$ unzip distribution-full-<version>.zip
Add the source to your project
For .war projects, copy the .jar files to the WEB-INF/lib
directory
For .ear projects, copy the .jar files to the EAR/lib directory
and add the following to META-INF/application.xml
:
<library-directory>lib</library-directory>
To check whether your Java environment needs any additional CDI-specific configuration, see Enable CDI For Your Java Environment.
To see ready-to-deploy example DeltaSpike applications, see See DeltaSpike in Action.
To understand how the various DeltaSpike modules can enhance and extend your applications, see Overview of DeltaSpike Modules and the individual module pages.