===== Prepare CzechIdM build on projects - with custom module ===== In this tutorial, I'll be using Eclipse, so if you are using another IDE is possible that some name will be different. Please follow tutorial in archetype. This tutorial may be obsolete. [[https://github.com/bcvsolutions/idm-module-archetype/blob/develop/README.md|Archetype tutorial]] ==== Step by step Backend ==== (I'll be using project name CGL) * create a new workspace * import CzechIdM projects with 'Existing Maven Projects' * import only idm-aggregator, idm-app and idm-example * create a copy of them and name it like aggregator, idm-app-cgl and idm-cgl, choose a suitable location {{ :tutorial:dev:project_01.png |}} === Aggregator === If you want to be able to build an application with an aggregator, please make sure that pom.xml in aggregator look like this: (Look at comments and change everything where is TODO in the comment!) ```xml 4.0.0 eu.bcvsolutions.idm cg-aggregator 1.0.0-SNAPSHOT pom CG - CzechIdM aggregator This module serves only as a sub module aggregator - it does not contain any source code, but running Maven goals on this project runs Maven goals on all of its modules successively. ../idm-cg ../idm-app-cg release com.atlassian.maven.plugins maven-jgitflow-plugin 1.0-m5.1 https://git.bcvsolutions.eu/zak/cg-czechidm-ng.git true false true true true true true true master develop org.apache.maven.plugins maven-deploy-plugin 2.8.1 true ``` * remove CzechIdM projects (idm-aggregator, idm-app and idm-example) [just from IDE] * open in idm-app-cgl project pom.xml and edit: ```xml idm-app-cgl war CzechIdM Application CzechIdM web application. Contains application modules with rest endpoints , authentication etc. nexus-releases https://nexus.bcvsolutions.eu/repository/maven-releases/ nexus-snapshots https://nexus.bcvsolutions.eu/repository/maven-snapshots/ ${project.groupId} idm-cgl 1.0.0-SNAPSHOT ${project.groupId} idm-core-impl ${project.version} ``` * then open pom.xml in idm-cgl project, edit idm-example, and * add after : ```xml 1.0.0-SNAPSHOT 7.8.4 nexus-releases https://nexus.bcvsolutions.eu/repository/maven-releases/ nexus-snapshots https://nexus.bcvsolutions.eu/repository/maven-snapshots/ ``` * so you'll have this state: {{ :tutorial:dev:project_02.png |}} * edit dependencies (still in pom.xml file) all product modules have to have this version: ${czechidm-version} * if wanted add modul dependency, for example: ```xml ${project.groupId} idm-pwdreset 1.2 ``` * in project idm-cgl in src/main/java delete all packages **exclude** eu.bcvsolutions.idm.example and eu.bcvsolutions.idm.example.config.flyway * in eu.bcvsolutions.idm.example delete ExampleModuleInitializer.java * rename {{ :tutorial:dev:project_03.png |}} * open CglModulDescriptor and rename MODULE_ID and all after method String getId() erase. In CglModulDescriptorshould be just: @Component @PropertySource("classpath:module-" + CglModuleDescriptor.MODULE_ID + ".properties") @ConfigurationProperties(prefix = "module." + CglModuleDescriptor.MODULE_ID + ".build", ignoreUnknownFields = true, ignoreInvalidFields = true) public class CglModuleDescriptor extends PropertyModuleDescriptor { public static final String MODULE_ID = "cgl"; @Override public String getId() { return MODULE_ID; } } * open CglFlywayConfig and rename all 'example' to 'cgl' * open src/main/resources and rename flyway-example.properties, module-example.properties and folder example * delete 'V1_00_001__example-create.sql' in postgres folder {{ :tutorial:dev:project_04.png |}} * in flyway-cgl.properties, module-cgl.properties change all example to cgl * in src/test/java delete all packages * Maven -> Update Project (right click on project folder) * Select Maven Profile (right click on project folder) ==== Frontend ==== * copy czechidm-app and czechidm-example to CGL/Realization/frontend and rename czechidm-example to czechidm-cgl * delete czechidm-app/dist and czechidm-app/node_modules * make file .gitignore in frontend folder with text: czechidm-acc/ czechidm-core/ czechidm-pwdreset/ czechidm-rpt/ czechidm-vs/ node_modules * delete all in czechidm-cgl/src/content * edit czechidm-cgl/src/locales, just this should be in both files: { "module": { "name": "Cgl", "author": "BCV solutions s.r.o." }, "content": { } } * czechidm-cgl/src/redux delete all managers, edit index.js: // const ManagerRoot = { }; ManagerRoot.version = '0.0.1'; module.exports = ManagerRoot; * czechidm-cgl/src/services delete all services and edit index.js: const ServiceRoot = { }; ServiceRoot.version = '0.1.0'; module.exports = ServiceRoot; * czechidm-cgl/themes rename example folder (to cgl) * edit czechidm-cgl/component-descriptor.js: module.exports = { 'id': 'cgl', 'name': 'Cgl', 'description': 'Components for Cgl module', 'components': [ ] }; * edit czechidm-cgl/module-descriptor.js: module.exports = { 'id': 'cgl', 'npmName': 'czechidm-cgl', 'backendId': 'cgl', 'name': 'CGL module for CzechIdM devstack.', 'description': 'CGL module', // 'mainStyleFile': 'src/css/main.less', 'mainRouteFile': 'routes.js', 'mainComponentDescriptorFile': 'component-descriptor.js', 'mainLocalePath': 'src/locales/', 'navigation': { 'items': [ ] } }; * edit czechidm-cgl/package.json: { "name": "czechidm-cgl", "version": "1.0.0-snapshot", "description": "Cgl module", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "CzechIdM", "cgl", "IdM" ], "author": "BCV solutions s.r.o", "license": "MIT" } * edit czechidm-cgl/component-descriptor.js: module.exports = { module: 'cgl', childRoutes: [ ] };