[id='project-storage-version-build-options-ref_{context}']
= Project storage and build options with {PRODUCT}

As you develop a {PRODUCT} project, you need to be able to track the versions of your project with a version-controlled repository, manage your project assets in a stable environment, and build your project for testing and deployment. You can use {CENTRAL} for all of these tasks, or use a combination of {CENTRAL} and external tools and repositories. {PRODUCT} supports Git repositories for project version control, Apache Maven for project management, and a variety of Maven-based, Java-based, or custom-tool-based build options.

The following options are the main methods for {PRODUCT} project versioning, storage, and building:

.Project version control options (Git)
[cols="25%,50%,25%", options="header"]
|===
|Versioning option
|Description
|Documentation

|{CENTRAL} Git VFS
|{CENTRAL} contains a built-in Git Virtual File System (VFS) that stores all processes, rules, and other artifacts that you create in the authoring environment. Git is a distributed version control system that implements revisions as commit objects. When you commit your changes into a repository, a new commit object in the Git repository is created. When you create a project in {CENTRAL}, the project is added to the Git repository connected to {CENTRAL}.
|NA

|External Git repository
|If you have {PRODUCT} projects in Git repositories outside of {CENTRAL}, you can import them into {PRODUCT} spaces and use Git hooks to synchronize the internal and external Git repositories.
a|
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#git-import-project[_{MANAGING_PROJECTS}_]
endif::[]
ifdef::DROOLS,JBPM,OP[]
NA
endif::[]
|===

.Project management options (Maven)
[cols="25%,50%,25%", options="header"]
|===
|Management option
|Description
|Documentation

|{CENTRAL} Maven repository
a|{CENTRAL} contains a built-in Maven repository that organizes and builds project assets that you create in the authoring environment. Maven is a distributed build-automation tool that uses repositories to store Java libraries, plug-ins, and other build artifacts. When building projects and archetypes, Maven dynamically retrieves Java libraries and Maven plug-ins from local or remote repositories to promote shared dependencies across projects.

NOTE: For a production environment, consider using an external Maven repository configured with {CENTRAL}.
a|
ifdef::DM,PAM[]
NA
endif::[]
ifdef::DROOLS,JBPM,OP[]
xref:#_wb.artifactrepository[]
endif::[]

|External Maven repository
|If you have {PRODUCT} projects in an external Maven repository, such as Nexus or Artifactory, you can create a link:https://maven.apache.org/settings.html[`settings.xml` file] with connection details and add that file path to the `kie.maven.settings.custom` property in your project `standalone-full.xml` file.
a|
link:https://maven.apache.org/settings.html[_Maven Settings Reference_]

ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#maven-external-configure-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_]
endif::[]
ifdef::DROOLS,JBPM,OP[]
xref:#_settings_xml_and_remote_repository_setup[]
endif::[]
|===

.Project build options
[cols="25%,50%,25%", options="header"]
|===
|Build option
|Description
|Documentation

|{CENTRAL} (KJAR)
|{CENTRAL} builds {PRODUCT} projects stored in either the built-in Maven repository or a configured external Maven repository. Projects in {CENTRAL} are packaged automatically as knowledge JAR (KJAR) files with all components needed for deployment when you build the projects.
a|
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#assembly-packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_]
endif::[]
ifdef::DROOLS,JBPM,OP[]
xref:#_wb.quickstartbuildanddeloy[]
endif::[]

|Standalone Maven project (KJAR)
|If you have a standalone {PRODUCT} Maven project outside of {CENTRAL}, you can edit the project `pom.xml` file to package your project as a KJAR file, and then add a `kmodule.xml` file with the KIE base and KIE session configurations needed to build the project.
a|
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#project-build-deploy-maven-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_]
endif::[]
ifdef::DROOLS,JBPM,OP[]
xref:#_buildingwithmaven[]
endif::[]

|Embedded Java application (KJAR)
|If you have an embedded Java application from which you want to build your {PRODUCT} project, you can use a `KieModuleModel` instance to programmatically create a `kmodule.xml` file with the KIE base and KIE session configurations, and then add all resources in your project to the KIE virtual file system `KieFileSystem` to build the project.
a|
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#project-build-deploy-java-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_]
endif::[]
ifdef::DROOLS,JBPM,OP[]
xref:#_definingakiemoduleprogrammatically[]
endif::[]

|CI/CD tool (KJAR)
|If you use a tool for continuous integration and continuous delivery (CI/CD), you can configure the tool set to integrate with your {PRODUCT} Git repositories to build a specified project. Ensure that your projects are packaged and built as KJAR files to ensure optimal deployment.
|NA

ifdef::DM,PAM[]
|S2I in OpenShift (container image)
|If you use {PRODUCT} on {OPENSHIFT}, you can build your {PRODUCT} projects as KJAR files in the typical way or use Source-to-Image (S2I) to build your projects as container images. S2I is a framework and a tool that allows you to write images that use the application source code as an input and produce a new image that runs the assembled application as an output. The main advantage of using the S2I tool for building reproducible container images is the ease of use for developers.

The {PRODUCT} images build the KJAR files as S2I automatically, using the source from a Git repository that you can specify. You do not need to create scripts or manage an S2I build.
|
For the S2I concept: https://access.redhat.com/documentation/en-us/openshift_container_platform/4.10/html/images/creating-images#images-create-s2i_create-images[_Images_] in the {OPENSHIFT} product documentation.

For the operator-based deployment process: {URL_DEPLOYING_ON_OPENSHIFT}#operator-environment-deploy-assy_openshift-operator[_{DEPLOYING_OPENSHIFT_OPERATOR}_]. In the {KIE_SERVER} settings, add a {KIE_SERVER} instance and then click *Set Immutable server configuration* to configure the source Git repository for an S2I deployment.
endif::[]
|===

////
Project version control options (Git)::
* *{CENTRAL} Git VFS*: {CENTRAL} contains a built-in Git Virtual File System (VFS) that stores all processes, rules, and other artifacts that you create in the authoring environment. Git is a distributed version control system that implements revisions as commit objects. When you commit your changes into a repository, a new commit object in the Git repository is created. When you create a project in {CENTRAL}, the project is added to the Git repository connected to {CENTRAL}.
* *External Git repository*: If you have {PRODUCT} projects in Git repositories outside of {CENTRAL}, you can import them into {CENTRAL} spaces and use Git hooks to synchronize the internal and external Git repositories. For more information about importing projects, see
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#git-import-project[_{MANAGING_PROJECTS}_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]

Project management options (Maven)::
* *{CENTRAL} Maven repository*: {CENTRAL} contains a built-in Maven repository that organizes and builds project assets that you create in the authoring environment. Maven is a distributed build automation tool that uses repositories to store Java libraries, plug-ins, and other build artifacts. When building projects and archetypes, Maven dynamically retrieves Java libraries and Maven plug-ins from local or remote repositories to promote shared dependencies across projects.
* *External Maven repository*: If you have {PRODUCT} projects in external Maven repository, such as Nexus or Artifactory, you can create a link:https://maven.apache.org/settings.html[`settings.xml` file] with connection details and add that file path to the `kie.maven.settings.custom` property in your project `standalone-full.xml` file. For more information about configuring an external Maven repository for your projects, see
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#maven-external-configure-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]

Project build options::
* *{CENTRAL}*: (KJAR) {CENTRAL} builds a specified {PRODUCT} project stored in either the built-in Maven repository or a configured external Maven repository. Projects in {CENTRAL} are packaged automatically as KJARs with all necessary components when you build the projects. For more information about building projects in {CENTRAL}, see
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#assembly-packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]
* *Standalone Maven project*: (KJAR) If you have a standalone {PRODUCT} Maven project outside of {CENTRAL}, you can edit the project `pom.xml` file to package your project as a KJAR file, and then add a `kmodule.xml` file with the KIE base and KIE session configurations needed to build the project. For more information about building projects in Maven, see
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#project-build-deploy-maven-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]
* *Embedded Java application*: (KJAR) If you have an embedded Java application from which you want to build your {PRODUCT} project, you can use a `KieModuleModel` instance to programmatically create a `kmodule.xml` file with the KIE base and KIE session configurations, and then add all resources in your project to the KIE virtual file system `KieFileSystem` to build the project. For more information about building projects in a Java application, see
ifdef::DM,PAM[]
{URL_DEPLOYING_AND_MANAGING_SERVICES}#project-build-deploy-java-proc_packaging-deploying[_{PACKAGING_DEPLOYING_PROJECT}_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]
* *CI/CD tool*: (KJAR) If you use a tool for continuous integration and continuous delivery (CI/CD), you can configure the tool set to integrate with your {PRODUCT} Git repositories to build a specified project. Ensure that your projects are packaged and built as KJAR files to ensure optimal deployment.
* *S2I in {OPENSHIFT}*: (container image) If you use {PRODUCT} on {OPENSHIFT}, you can build your {PRODUCT} projects as KJAR files in the typical way or use Source-to-Image (S2I) to build your projects as container images. S2I is a framework and a tool that allows you to write images that use the application source code as an input and produce a new image that runs the assembled application as an output. The main advantage of using the S2I tool for building reproducible container images is the ease of use for developers. For more information about building projects with S2I, see
ifdef::DM,PAM[]
https://access.redhat.com/documentation/en-us/openshift_container_platform/3.3/html/creating_images/creating-images-s2i[_Creating Images_].
endif::[]
ifdef::DROOLS,JBPM,OP[]

endif::[]
////
