klouisbrother
klouisbrother

Reputation: 111

How to integrate Hybris Custom and Config folder to local installation?

I installed Hybris 1905 out of the box locally on my machine and I would like to include the custom code which our project stores on bitbucket.

To track the progress of the commits, I installed earlier Sourcetree and have integrated the repository. The repo is stored locally in directory

C:\git\projectname

How can I now get the folders custom and config into my local installation to be able to run always the latest code in my local machine? Thanks!

Upvotes: 2

Views: 2227

Answers (2)

Adiputera
Adiputera

Reputation: 196

You can create a symlink or directory junction.

Assuming your custom config is stored in C:\git\projectname\config and your custom code is stored in C:\git\projectname\bin\custom

In hybrisHomeDirectory, open command prompt then type :

mklink /J config C:\git\projectname\config

this will create a directory junction that link your config to hybris installation folder.

In hybrisHomeDirectory/bin, open command prompt then type :

mklink /J custom C:\git\projectname\bin\custom

This will create a directory junction that link your custom code.

If you want to create a symlink instead of directory junction (requires admin), then open cmd as administrator and type mklink /D instead of mlink /J

Upvotes: 1

dj_frunza
dj_frunza

Reputation: 1593

  1. Config folder

In order to refer a config folder(other than the default one) you can edit your hybris\bin\platform\setantenv.bat. For example please have a look at my setantenv.bat that I used in the past:

@echo off
set ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Djdk.util.jar.enableMultiRelease=force
set ANT_HOME=%~dp0apache-ant
set PATH=%ANT_HOME%\bin;%PATH%
rem deleting CLASSPATH as a workaround for PLA-8702
set CLASSPATH=

Rem Custom zone start
set HYBRIS_RUNTIME_PROPERTIES=%~dp0local_custom.properties
chcp 65001
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config

echo -------CustomChanges--------
echo CustomChanges: configFolder: %HYBRIS_CONFIG_DIR%
echo CustomChanges: runTimeProperties: %HYBRIS_RUNTIME_PROPERTIES%
echo -------CustomChanges--------
Rem Custom zone end

echo ant home: %ANT_HOME%
echo ant opts: %ANT_OPTS%
ant -version

Between Rem Custom zone start and Rem Custom zone end there is the Custom section that, among other things, sets the path to the config folder.

In my case, hybris folder and gitrepo folder are right next to eachother(in the same parent folder) and that is why the following path(also mentioned above) works:

set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config

Keeping these two folders next to each other makes it easier to use relatives paths in order to easily use resources from git Repo into Hybris.

  1. Custom folder

In order for Hybris to take into consideration the custom extensions, their folder needs to be specified in the localextensions.xml as exemplified below:

<path autoload="true" dir="${HYBRIS_BIN_DIR}/../../gitRepo/extensions"/>

Again, above relative path works for me because hybris and gitrepo folders are next to each other.

Upvotes: 0

Related Questions