Skip to content

Commit

Permalink
[Rahul] | BAH-3969 | Fix. Tomcat 10 Build Files
Browse files Browse the repository at this point in the history
  • Loading branch information
rahu1ramesh committed Jun 25, 2024
1 parent 0aa7c62 commit 13ef075
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 147 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tomcat_build_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ jobs:
distribution: "corretto"
java-version: "17"
- name: Generate Artifact for bahmni-embedded-tomcat-10
run: mvn clean package -f bahmni-embedded-tomcat-10/pom.xml
run: |
cd bahmni-embedded-tomcat-10
gradle clean build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
61 changes: 61 additions & 0 deletions bahmni-embedded-tomcat-10/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
id 'java'
}
group 'org.bahmni.deployment'
version '1.0-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
jcenter()
maven {
url 'https://mavenrepo.openmrs.org/nexus/content/repositories/public' // Use HTTPS instead of HTTP
}
maven {
url 'https://oss.sonatype.org/content/repositories' // Use HTTPS
}
}

def tomcatVersion = '10.1.24' // Define Tomcat version here

dependencies {
implementation "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
implementation "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
implementation "org.apache.tomcat:tomcat-jasper:${tomcatVersion}"
implementation "org.apache.tomcat:tomcat-jasper-el:${tomcatVersion}"
implementation "org.apache.tomcat:tomcat-jsp-api:${tomcatVersion}"
}

jar {
duplicatesStrategy = 'exclude'

manifest {
attributes 'Main-Class': 'org.bahmni.deployment.launch.Main'
}

from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}

exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}

configurations {
all {
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
exclude group: 'javax.jms', module: 'jms'
exclude group: 'javax.mail', module: 'mail'
}
}

// Print Tomcat version after project configuration
gradle.afterProject { project ->
println "Built with Apache Tomcat version: ${tomcatVersion}"
}
134 changes: 0 additions & 134 deletions bahmni-embedded-tomcat-10/pom.xml

This file was deleted.

3 changes: 3 additions & 0 deletions bahmni-embedded-tomcat-10/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rootProject.name = 'bahmni'

include 'bahmni-embedded-tomcat-10'
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
import org.apache.catalina.startup.Tomcat;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import static java.lang.Integer.valueOf;
import static java.lang.System.getenv;

public class Main {
public static void main(String[] args) throws NumberFormatException, NullPointerException, IllegalArgumentException, ServletException, LifecycleException, IllegalStateException, FileNotFoundException, IOException{
Tomcat tomcat = new Tomcat();
tomcat.setPort(Integer.parseInt(getenv("SERVER_PORT")));
tomcat.setBaseDir(getenv("BASE_DIR"));

Context context = tomcat.addWebapp(getenv("CONTEXT_PATH"), new File(getenv("WAR_DIRECTORY")).getAbsolutePath());
context.setSessionTimeout(120);
context.setUseHttpOnly(false);

tomcat.start();
tomcat.getServer().await();
}
public static void main(String[] args) throws LifecycleException, ServletException, IOException {
Tomcat tomcat = new Tomcat();
tomcat.setPort(valueOf(getenv("SERVER_PORT")));
tomcat.setBaseDir(getenv("BASE_DIR"));
Context context = tomcat.addWebapp(getenv("CONTEXT_PATH"), new File(getenv("WAR_DIRECTORY")).getAbsolutePath());
context.setSessionTimeout(120);
context.setUseHttpOnly(false);
tomcat.start();
tomcat.getServer().await();
}
}

0 comments on commit 13ef075

Please sign in to comment.