Table of Contents

CODI Module Overview

MyFaces CODI consists of the following modules:

Required modules:

Optional modules:

Optional configuration modules:

Optinal Java-EE5 Support Modules
The following Modules are NOT needed with Java-EE6+ application servers.

  • OpenWebBeans Support Module
  • Weld Suppord Module

Optional All-in-one bundles (alternative to the separated modules above)

  • All CODI modules for JSF 1.2
  • All CODI modules for JSF 2.0+
  • All CODI modules for JSF 1.2 OSGi bundle
  • All CODI modules for JSF 2.0+ OSGi bundle
  • Alternative-configuration
  • Alternative-configuration OSGi

Scroll down to see how to add those modules to your project.

Configuration - Getting Started (with Maven)

It's quite easy to add CODI to your project. Just add the core as well as the module/s of your choice to the pom.xml of your project.

Hint
In the listings below replace the placeholders for the version with the version of your choice or use:

Optional properties
<properties>
    <codi.version>1.0.3</codi.version>
</properties>

With JEE6+

If you are using CODI in a JEE6 environment, you don't need to configure a CDI implementation explicitly because it's shipped with the container. For some JEE6 application servers (esp. Glassfish v3) it's suggested to use the all-in-one dist package instead of the fine grained modules (due to server related issues).

Without JEE6+

JEE5 application servers as well as pure servlet containers like Apache Tomcat don't provide a CDI implementation out-of-the-box. So don't forget to setup the CDI implementation of your choice. If you would like to use CODI in combination with OpenWebBeans, you can also use the archetype provided by MyFaces.

Archetype for creating a Hello-World CODI/OWB Demo
mvn archetype:generate -DarchetypeCatalog=http://myfaces.apache.org

CODI-Core Module (required)

CODI-Core module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
    <artifactId>myfaces-extcdi-core-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.core</groupId>
    <artifactId>myfaces-extcdi-core-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI JSF Modules

CODI for JSF 1.2 (optional)

CODI-JSF 1.2 module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-jsf12-module-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-jsf12-module-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI for JSF 2.0 or 2.1 (optional)

CODI-JSF 2.0 module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-jsf20-module-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-jsf20-module-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI Bean-Validation (JSR-303) Module (optional)

CODI-BV 1.0 module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-bv1-module-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-bv1-module-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI Scripting (JSR-223) Module (optional)

CODI-Scripting module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-scripting-module-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-scripting-module-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI Message (Advanced I18N) Module (optional)

CODI-Message module dependencies
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-message-module-api</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules</groupId>
    <artifactId>myfaces-extcdi-message-module-impl</artifactId>
    <version>${codi.version}</version>
    <scope>runtime</scope>
</dependency>

CODI pre-packaged bundles

If you would like to test CODI or you need all modules provided by CODI, you can use an all-in-one JAR file.

Only use this bundle or the core and the single modules - but don't use both!

OPTIONAL all-in-one dependency for JSF 1.2 projects
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.bundles</groupId>
    <artifactId>myfaces-extcdi-bundle-jsf12</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

or

OPTIONAL all-in-one dependency for JSF 2.0 projects
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.bundles</groupId>
    <artifactId>myfaces-extcdi-bundle-jsf20</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

Entries for CODI v0.9.x (deprecated)

OPTIONAL all-in-one dependency for JSF 1.2 projects - for CODI 0.9.x
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi</groupId>
    <artifactId>myfaces-extcdi-dist-jsf12</artifactId>
    <version>0.9.5</version>
    <scope>compile</scope>
</dependency>

or

OPTIONAL all-in-one dependency for JSF 2.0 projects - for CODI 0.9.x
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi</groupId>
    <artifactId>myfaces-extcdi-dist-jsf20</artifactId>
    <version>0.9.5</version>
    <scope>compile</scope>
</dependency>





Alternative Configuration

The basic idea is to use type-safe config or any custom approach which is possible due to @Alternative or @Specializes. However, sometimes you would like to use e.g. a property file or any other config-file format. Furthermore, new versions of Weld implement also @Alternative more strictly (at least versions which implement CDI v1.0). So it's more difficult to use the original approach. So CODI (v1+) provides two modules to get rid of this problem. (Due to Glassfish 3.1 bugs it's required to use Glassfish 3.2+.)

Alternative-Implementation (optional)

OPTIONAL Alternative-Implementation module
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules.alternative</groupId>
    <artifactId>myfaces-extcdi-alternative-implementation-module</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

Alternative configuration modules (optional)

Alternative Core configuration module (optional)

OPTIONAL Core Alternative-configuration module
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules.alternative</groupId>
    <artifactId>myfaces-extcdi-core-alternative-configuration</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

Alternative Jsf configuration module (optional)

OPTIONAL JSF Alternative-configuration module
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.modules.alternative</groupId>
    <artifactId>myfaces-extcdi-jsf-alternative-configuration</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

Alternative configuration module bundle (optional)

Similar to the JSF bundles of CODI there is a config bundle which bundles the single modules described above.

Only use this bundle or the single config modules - but don't use both!

OPTIONAL all-in-one dependency Alternative-configuration bundle
<dependency>
    <groupId>org.apache.myfaces.extensions.cdi.bundles</groupId>
    <artifactId>myfaces-extcdi-bundle-alternative-configuration</artifactId>
    <version>${codi.version}</version>
    <scope>compile</scope>
</dependency>

Configuration - Getting Started (without Maven)

You can manually download all JARs described above from the maven repository or you use one of the available download mirrors for binary and source artifacts which bundle all JARs.