Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an Ozone Implementation archetype #40

Merged
merged 15 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main
with:
java-version: "8"
maven-phase: "install"
maven-args: "-P validator" # OMRS config validation
secrets:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ozone

> The entreprise-grade health information system that augments OpenMRS 3.
> The enterprise-grade health information system that augments OpenMRS 3

# Quick start

Expand Down Expand Up @@ -63,3 +63,22 @@ For example:
Ozone FOSS requires you to log into each component separately.

💡 **Did you know?** Ozone Pro comes with single sign-on (SSO) and all its integration layer is secured with OAuth2.

## Create Your Own Distribution
ibacher marked this conversation as resolved.
Show resolved Hide resolved

This Ozone project provides tooling to help create your own distribution. To get started, you first need to install the
archetype by running:

```bash
./scripts/mvn -pl ozone-distro-archetype clean install
ibacher marked this conversation as resolved.
Show resolved Hide resolved
```

Once that's done, you can use the Maven Archetype by running:

```bash
./scripts/mvn archetype:generate -DarchetypeGroupId=com.ozonehis -DarchetypeArtifactId=ozone-distro-archetype
```

This will prompt you for details about your project and create a standard Maven repository in the local directory.

**Note** You do **not** want your distribution to be part of the Ozone source code, so you should create it in a directory that does not contain this project.
34 changes: 34 additions & 0 deletions ozone-distro-archetype/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?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>
<parent>
<groupId>com.ozonehis</groupId>
<artifactId>ozone-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../ozone-parent</relativePath>
</parent>

<artifactId>ozone-distro-archetype</artifactId>
<packaging>maven-archetype</packaging>

<name>Archetype - Ozone Distribution</name>
<description>A Maven Archetype for Ozone distributions</description>

<url>https://www.ozone-his.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>3.2.1</version>
</extension>
</extensions>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.nio.file.Files
import java.nio.file.Paths

projectDirectory = Paths.get(request.outputDirectory, request.artifactId);

def run(String command) {
def process = command.execute(null, projectDirectory.toFile());
process.consumeProcessOutput(System.out, System.err)
process.waitFor()
if (process.exitValue() != 0) {
throw new RuntimeException("'$command' exited with code ${process.exitValue()}")
}
}

run("mvn wrapper:wrapper")
Files.move(projectDirectory.resolve(".mvn"), projectDirectory.resolve("scripts").resolve(".mvn"))
Files.move(projectDirectory.resolve("mvnw"), projectDirectory.resolve("scripts").resolve("mvnw"))
Files.move(projectDirectory.resolve("mvnw.cmd"), projectDirectory.resolve("scripts").resolve("mvnw.cmd"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 https://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="Ozone Distribution Archetype">

<requiredProperties>
<requiredProperty key="distributionName" />
<requiredProperty key="version">
<!-- Work-around for https://issues.apache.org/jira/browse/ARCHETYPE-308
By using an expression, we should prompt for the value, with a default of 1.0.0-SNAPSHOT -->
<defaultValue>${package.getClass().forName("java.lang.String").getConstructor($package.getClass().forName("java.lang.String")).newInstance("1.0.0-SNAPSHOT")}</defaultValue>
</requiredProperty>
</requiredProperties>

<fileSets>
<fileSet>
<directory>config</directory>
<includes>
<include>**/*.*</include>
</includes>
</fileSet>
<fileSet>
<directory>scripts</directory>
<includes>
<include>**/*.sh</include>
</includes>
</fileSet>
<fileSet filtered="true">
<directory />
<includes>
<include>.gitignore</include>
<include>.gitpod.yml</include>
<include>README.md</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
Loading