Releasing UgandaEMR SPA Module.

@dkayiwa we have created a new module that will support the implementation of microfrontends in UgandaEMR, however, on releasing, the repo does not exist error shows up as shown below

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project ugandaemrspa: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] ERROR: Repository not found.
[ERROR] fatal: Could not read from remote repository.
[ERROR] 
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.

Any suggestions to help is highly welcome.

1 Like

@solemabrothers Could it be that that someone else pushed a commit to the same branch you’re pushing to, but you don’t have that commit on your laptop yet? To fix this issue, run:

git pull origin <your-branch>
git push origin <your-branch>

@solemabrothers what is the output of git remote -v

if you have both origin and upstream, make sure you are pushing on the remote where you have administrator privileges.

As an addition, remember to stage all changes pull all changes: git fetch --all and there after git pull --all

@jwnasambu and @jwnasambu kinldy note that we are not pulling or pushing to a git repo, we are releasing one of our modules and the first step is to perform

mvn  release:prepare 

It is at this point that the preparation for the module fails.

2 Likes

For the Maven Release plugin to work you need to have a fair bit of metadata configured in your POM. In particular, you should have:

  • A SCM section with both a connection and developerConnection entry. (This is what’s failing; the documentation on Maven’s Git support can be found here).
  • A distributionManagement section with details of which Maven repositor(ies) to push the artefacts to.
3 Likes

@ibacher here is my main pom file, I have updated it to add the distribution management and also set the correct git repos as advised.

		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

    <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>ugandaemrspa</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>pom</packaging>
	<name>UgandaEMR SPA</name>
	<description>This is the module that introduces Micro-front ends into UgandaEMR using Single Page Applications</description>

	<url>https://wiki.openmrs.org/x/FQ4z</url>

	<scm>
		<connection>scm:git:git@github.com:METS-Programme/openmrs-module-ugandaemr-spa.git</connection>
		<developerConnection>scm:git:git@github.com:METS-Programme/openmrs-module-ugandaemr-spa.git</developerConnection>
		<url>https://github.com/METS-Programme/openmrs-module-ugandaemr-spa</url>
	</scm>

	<modules>
		<module>api</module>
		<module>omod</module>
	</modules>

	<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>

	<build>
		<finalName>${project.parent.artifactId}-${project.parent.version}</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>src/main/webapp</directory>
				<filtering>true</filtering>
				<excludes>
					<exclude>resources</exclude>
				</excludes>
				<targetPath>web/module</targetPath>
			</resource>
			<resource>
				<directory>src/main/webapp</directory>
				<filtering>false</filtering>
				<includes>
					<include>resources</include>
				</includes>
				<targetPath>web/module</targetPath>
			</resource>
		</resources>

		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
				<filtering>true</filtering>
			</testResource>
		</testResources>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<configuration>
						<target>1.7</target>
						<source>1.7</source>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.openmrs.maven.plugins</groupId>
					<artifactId>maven-openmrs-plugin</artifactId>
					<version>1.0.1</version>
					<extensions>true</extensions>
					<executions>
						<execution>
							<id>init</id>
							<phase>initialize</phase>
							<goals>
								<goal>initialize-module</goal>
							</goals>
						</execution>
						<execution>
							<id>pack</id>
							<phase>package</phase>
							<goals>
								<goal>package-module</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<executions>
						<execution>
							<id>Expand moduleApplicationContext and messages</id>
							<goals>
								<goal>unpack-dependencies</goal>
							</goals>
							<phase>generate-resources</phase>
							<configuration>
								<includeGroupIds>${project.parent.groupId}</includeGroupIds>
								<includeArtifactIds>${project.parent.artifactId}-api</includeArtifactIds>
								<excludeTransitive>true</excludeTransitive>
								<includes>**/*</includes>
								<outputDirectory>${project.build.directory}/classes</outputDirectory>
							</configuration>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5</version>
					<configuration>
						<autoVersionSubmodules>true</autoVersionSubmodules>
						<tagNameFormat>@{project.version}</tagNameFormat>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>2.3.2</version>
					<configuration>
						<archive>
							<manifestEntries>
								<Build-Timestamp>${TIMESTAMP}</Build-Timestamp>
								<Specification-Version>${openmrs.version.shortnumericonly}</Specification-Version>
								<Specification-Vendor>${openmrs.version.long}</Specification-Vendor>
							</manifestEntries>
						</archive>
					</configuration>
					<executions>
						<execution>
							<goals>
								<goal>test-jar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	<distributionManagement>
		<repository>
			<id>openmrs-repo-modules</id>
			<name>OpenMRS Modules</name>
			<url>https://openmrs.jfrog.io/artifactory/modules/</url>
		</repository>
		<snapshotRepository>
			<id>openmrs-repo-snapshots</id>
			<name>OpenMRS Snapshots</name>
			<url>https://openmrs.jfrog.io/openmrs/snapshots</url>
		</snapshotRepository>
	</distributionManagement>


	<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>
		<ugandaemrVersion>3.3.5</ugandaemrVersion>
		<spaVersion>1.0.8</spaVersion>
		<initializerVersion>2.1.0</initializerVersion>
	</properties>
</project>

I am still getting the same error as above.

@ibacher turns out re-cloning the module and doing the release again works fine. Thank you for the help, this is fixed.