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. Archetype tutorial

(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

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 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>eu.bcvsolutions.idm</groupId>
  <artifactId>cg-aggregator</artifactId> <!-- TODO This name shold be name of your project -->
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>CG - CzechIdM aggregator</name> <!-- TODO change to chosen name -->
  <description>
      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.
  </description>
  <modules>
      <module>../idm-cg</module> <!-- TODO change to module of company -->
      <module>../idm-app-cg</module> <!-- TODO change to app module of company -->
  </modules>
  <profiles>
      <profile>
          <!-- Profile is used for releasing product. Usage is described in documentation -->
          <id>release</id>
          <build>
              <plugins>
                  <plugin>
                      <groupId>com.atlassian.maven.plugins</groupId>
                      <artifactId>maven-jgitflow-plugin</artifactId>
                      <version>1.0-m5.1</version>
                      <configuration>
                          <defaultOriginUrl>https://git.bcvsolutions.eu/zak/cg-czechidm-ng.git</defaultOriginUrl> <!-- Here should be https of git project address -->
                          <pushReleases>true</pushReleases>
                          <keepBranch>false</keepBranch>
                          <autoVersionSubmodules>true</autoVersionSubmodules>
                          <noTag>true</noTag>
                          <allowUntracked>true</allowUntracked>
                          <pullDevelop>true</pullDevelop>
                          <pullMaster>true</pullMaster>
                          <allowSnapshots>true</allowSnapshots>
                          <flowInitContext>
                              <masterBranchName>master</masterBranchName> <!-- TODO make sure that both branches are same -->
                              <developBranchName>develop</developBranchName> <!-- TODO make sure that both branches are same -->
                          </flowInitContext>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-deploy-plugin</artifactId>
                      <version>2.8.1</version>
                      <!-- Deploying this module on nexus is not demmanded -->
                      <configuration>
                          <skip>true</skip>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
      </profile>
  </profiles>

</project> ```

  • remove CzechIdM projects (idm-aggregator, idm-app and idm-example) [just from IDE]
  • open in idm-app-cgl project pom.xml and edit:

```xml <artifactId>idm-app-cgl</artifactId>

<packaging>war</packaging>
<name>CzechIdM Application</name>
<description>CzechIdM web application. Contains application modules with rest endpoints , authentication etc.</description>
<repositories>
	<repository>
	    <id>nexus-releases</id>
	    <url>https://nexus.bcvsolutions.eu/repository/maven-releases/</url>
	</repository>
	<!-- After release stable version of CzechIdMng remove repository snapshots -->
	<repository>
	    <id>nexus-snapshots</id>
	    <url>https://nexus.bcvsolutions.eu/repository/maven-snapshots/</url>
	</repository>
</repositories>
<dependencies>
	<dependency>
		<groupId>${project.groupId}</groupId>
		<artifactId>idm-cgl</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</dependency>
	<dependency>
		<groupId>${project.groupId}</groupId>
		<artifactId>idm-core-impl</artifactId>
		<version>${project.version}</version>
	</dependency>
</dependencies>

```

  • then open pom.xml in idm-cgl project, edit <artifactId>idm-example</artifactId>, <name> and <description>
  • add after <description>:

```xml

      <version>1.0.0-SNAPSHOT</version>

<properties>
	<czechidm-version>7.8.4</czechidm-version>
</properties>
<repositories>
	<repository>
	    <id>nexus-releases</id>
	    <url>https://nexus.bcvsolutions.eu/repository/maven-releases/</url>
	</repository>
	<!-- After release stable version of CzechIdMng remove repository snapshots -->
	<repository>
	    <id>nexus-snapshots</id>
	    <url>https://nexus.bcvsolutions.eu/repository/maven-snapshots/</url>
	</repository>
</repositories>

```

  • so you'll have this state:

  • edit dependencies (still in pom.xml file) all product modules have to have this version: <version>${czechidm-version}</version>
  • if wanted add modul dependency, for example:

```xml

              <dependency>
		<groupId>${project.groupId}</groupId>
		<artifactId>idm-pwdreset</artifactId>
		<version>1.2</version>
	</dependency>

```

  • 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

  • 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

  • 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)
  • 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: [
  ]
};
  • by kopro