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

Add maven war plugin for Tomcat deploy #393

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Run API
run: |
cd target
java -cp "openhospital-api-0.1.0.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher &
java -cp "oh.jar:rsc/:static/" org.springframework.boot.loader.JarLauncher &
sleep 60

- name: Generate OpenAPI yaml
Expand Down
22 changes: 11 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -47,6 +37,11 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand Down Expand Up @@ -142,6 +137,7 @@
</dependencies>

<build>
<finalName>oh</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -155,7 +151,11 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>${project.build.directory}/test-reports</reportsDirectory>
</configuration>
</plugin>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/isf/OpenHospitalApiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ImportResource;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

@ImportResource({ "classpath*:/applicationContext.xml" })
@SpringBootApplication
public class OpenHospitalApiApplication {
public class OpenHospitalApiApplication extends SpringBootServletInitializer {

@Autowired
private ObjectMapper objectMapper;
Expand Down
25 changes: 10 additions & 15 deletions src/main/java/org/isf/config/OpenAPIConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,21 @@

@Configuration
@SecuritySchemes({
@SecurityScheme(
name = "bearerAuth",
type = SecuritySchemeType.HTTP,
bearerFormat = "JWT",
scheme = "bearer"
)
@SecurityScheme(name = "bearerAuth", type = SecuritySchemeType.HTTP, bearerFormat = "JWT", scheme = "bearer")
})
public class OpenAPIConfiguration {

@Bean
public OpenAPI springShopOpenAPI() {
return new OpenAPI().addSecurityItem(
new SecurityRequirement().addList("bearerAuth"))
.info(new Info().title("OH 2.0 Api Documentation")
.description("OH 2.0 Api Documentation")
.version("1.0").contact(new Contact().name("ApiInfo.DEFAULT_CONTACT"))
.license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0")))
.servers(List.of(new Server().url("http://localhost:8080")))
.components(new Components().schemas(Map.of(
"LocalDate", new DateSchema().name("LocalDate").type("string").format(null),
"LocalDateTime", new DateTimeSchema().name("LocalDateTime").type("string").format(null))));
new SecurityRequirement().addList("bearerAuth"))
.info(new Info().title("OH 2.0 Api Documentation")
.description("OH 2.0 Api Documentation")
.version("1.0").contact(new Contact().name("ApiInfo.DEFAULT_CONTACT"))
.license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0")))
.servers(List.of(new Server().url("http://localhost:8080/oh")))
.components(new Components().schemas(Map.of(
"LocalDate", new DateSchema().name("LocalDate").type("string").format(null),
"LocalDateTime", new DateTimeSchema().name("LocalDateTime").type("string").format(null))));
}
}
Loading