Hello everyone, I hope you are doing well. I am currently encountering a problem while creating a new module for OpenMRS. I followed the steps on the wiki, but there is a version issue when I run the maven clean install.
Hi @christiantsopkeng this should guide you https://openmrs.atlassian.net/wiki/spaces/docs/pages/25477395/Create+and+Deploy+Your+First+OpenMRS+Module
Yes, these are the exact steps I followed, but at the mvn clean install stage, there is a version problem that occurs at the .pom file level if I am not mistaken.
This should be run at the codebase level of your new module. Then deploy the .omod file to the openmrs server setup locally
the new module that I created this icd name I placed myself in its directory before launching the commands but this triggers errors that I cannot resolve, have you already had to create a new module with these commands?
Can you share the contents of your pom.xml at the root of your module?
@christiantsopkeng First and foremost looks like you placed the module code in the server directory, which is not recommended, so I can’t tell what your trying to run exactly
the module that I created is named icd it contains 3 .pom files 1 in api one in omod and one in the root
4.0.0
<parent>
<groupId>org.openmrs.maven.parents</groupId>
<artifactId>maven-parent-openmrs-module</artifactId>
<version>1.1.0</version>
</parent>
<groupId>org.openmrs.module</groupId>
<artifactId>icd</artifactId>
<version>3.0.0</version>
<packaging>pom</packaging>
<name>Icd</name>
<description>no description</description>
<url>https://wiki.openmrs.org/x/FQ4z</url>
<scm>
<connection>scm:git:git@github.com:openmrs/openmrs-module-icd.git</connection>
<developerConnection>scm:git:git@github.com:openmrs/openmrs-module-icd.git</developerConnection>
<url>https://github.com/openmrs/openmrs-module-icd/</url>
</scm>
<modules>
<module>api</module>
<module>omod</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- Importing versions from refapp distro -->
<dependency>
<groupId>org.openmrs.distro</groupId>
<artifactId>referenceapplication</artifactId>
<version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>maven-openmrs-plugin</artifactId>
<version>1.0.1</version>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>directories</id>
<goals>
<goal>highest-basedir</goal>
</goals>
<phase>validate</phase>
<configuration>
<property>main.basedir</property>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<header>${main.basedir}${file.separator}license-header.txt</header>
<headerDefinitions>
<headerDefinition>${main.basedir}${file.separator}license-format.xml</headerDefinition>
</headerDefinitions>
<mapping>
<java>JAVA_STYLE</java>
<xml>MYXML_STYLE</xml>
</mapping>
<includes>
<include>**/*.java</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>license-format.xml</exclude>
<exclude>**/pom.xml</exclude>
<exclude>**/target/**</exclude>
<exclude>.git/**</exclude>
<exclude>.idea/**</exclude>
<exclude>.settings/**</exclude>
<exclude>.externalToolBuilders/</exclude>
<exclude>nbproject/private/</exclude>
<exclude>.vscode/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>add-license</id>
<goals>
<goal>format</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<!-- Fix for "Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project application-etude: Input length = 1" -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- Spotless plugin -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.27.2</version>
<configuration>
<java>
<licenseHeader>
<file>${project.basedir}/license-header.txt</file>
</licenseHeader>
<eclipse>
<file>${project.basedir}/OpenMRSFormatter.xml</file>
</eclipse>
<removeUnusedImports/>
<importOrder>
<order>javax,java</order>
</importOrder>
</java>
<formats>
<format>
<includes>
<include>**/*.xml</include>
</includes>
<licenseHeader>
<file>${project.basedir}/license-header.txt</file>
<delimiter>^(?!<\?xml)</delimiter>
</licenseHeader>
</format>
</formats>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<phase>validate</phase>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<openmrsPlatformVersion>1.11.6</openmrsPlatformVersion>
</properties>
4.0.0 org.openmrs.module icd 3.0.0
<artifactId>icd-api</artifactId>
<packaging>jar</packaging>
<name>Icd API</name>
<description>API project for Icd</description>
4.0.0 org.openmrs.module icd 3.0.0
<artifactId>icd-omod</artifactId>
<packaging>jar</packaging>
<name>Icd OMOD</name>
<description>Omod submodule for Icd</description>
<dependencies>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>icd-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.openmrs.web</groupId>
<artifactId>openmrs-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openmrs.web</groupId>
<artifactId>openmrs-web</artifactId>
<scope>provided</scope>
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>uiframework-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.parent.artifactId}-${project.parent.version}</finalName>
<plugins>
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>maven-openmrs-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>
4.0.0
<parent>
<groupId>org.openmrs.maven.parents</groupId>
<artifactId>maven-parent-openmrs-module</artifactId>
<version>1.1.0</version>
</parent>
<groupId>org.openmrs.module</groupId>
<artifactId>icd</artifactId>
<version>3.0.0</version>
<packaging>pom</packaging>
<name>Icd</name>
<description>no description</description>
<url>https://wiki.openmrs.org/x/FQ4z</url>
<scm>
<connection>scm:git:git@github.com:openmrs/openmrs-module-icd.git</connection>
<developerConnection>scm:git:git@github.com:openmrs/openmrs-module-icd.git</developerConnection>
<url>https://github.com/openmrs/openmrs-module-icd/</url>
</scm>
<modules>
<module>api</module>
<module>omod</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- Importing versions from refapp distro -->
<dependency>
<groupId>org.openmrs.distro</groupId>
<artifactId>referenceapplication</artifactId>
<version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>maven-openmrs-plugin</artifactId>
<version>1.0.1</version>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>directories</id>
<goals>
<goal>highest-basedir</goal>
</goals>
<phase>validate</phase>
<configuration>
<property>main.basedir</property>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<header>${main.basedir}${file.separator}license-header.txt</header>
<headerDefinitions>
<headerDefinition>${main.basedir}${file.separator}license-format.xml</headerDefinition>
</headerDefinitions>
<mapping>
<java>JAVA_STYLE</java>
<xml>MYXML_STYLE</xml>
</mapping>
<includes>
<include>**/*.java</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>license-format.xml</exclude>
<exclude>**/pom.xml</exclude>
<exclude>**/target/**</exclude>
<exclude>.git/**</exclude>
<exclude>.idea/**</exclude>
<exclude>.settings/**</exclude>
<exclude>.externalToolBuilders/</exclude>
<exclude>nbproject/private/</exclude>
<exclude>.vscode/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>add-license</id>
<goals>
<goal>format</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<!-- Fix for "Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project application-etude: Input length = 1" -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- Spotless plugin -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.27.2</version>
<configuration>
<java>
<licenseHeader>
<file>${project.basedir}/license-header.txt</file>
</licenseHeader>
<eclipse>
<file>${project.basedir}/OpenMRSFormatter.xml</file>
</eclipse>
<removeUnusedImports/>
<importOrder>
<order>javax,java</order>
</importOrder>
</java>
<formats>
<format>
<includes>
<include>**/*.xml</include>
</includes>
<licenseHeader>
<file>${project.basedir}/license-header.txt</file>
<delimiter>^(?!<\?xml)</delimiter>
</licenseHeader>
</format>
</formats>
</configuration>
<executions>
<execution>
<id>spotless-apply</id>
<phase>validate</phase>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<openmrsPlatformVersion>1.11.6</openmrsPlatformVersion>
</properties>
I wanted you to share the root pom.xml but that’s okay. So the error
[ERROR] Non-resolvable import POM: The following artifacts could not be resolved: org.openmrs.distro:referenceapplication:pom:3.0.0 (absent): Could not find artifact org.openmrs.distro:referenceapplication:pom:3.0.0 in openmrs-repo (https://mavenrepo.openmrs.org/public) @ line 34, column 25 -> [Help 2]
suggests that you trying to create a 3.x module using the SDK’s create-project
which is not possible. We are only able to generate 2.x referenceapplication modules with the SDK.
For 3.x modules, please refer to Creating a frontend module – O3 Docs
Ok I will try with both methods, version 2.x and the frontend module and I will get back to you, thanks