use version from the pom
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 1m6s

This commit is contained in:
Lee 2024-04-10 10:48:15 +01:00
parent cb7c2e162f
commit c0c4e32809
2 changed files with 31 additions and 3 deletions

20
pom.xml
View File

@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cc.fascinated</groupId>
<artifactId>Minecraft-Helper</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>Minecraft-Utilities</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
@ -21,11 +21,27 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<!-- Build Steps -->
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- Spring -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<description>${project.description}</description>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -5,6 +5,8 @@ import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.info.BuildProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -12,6 +14,16 @@ import java.util.List;
@Configuration
public class OpenAPIConfiguration {
/**
* The build properties of the
* app, null if the app is not built.
*/
private final BuildProperties buildProperties;
@Autowired
public OpenAPIConfiguration(BuildProperties buildProperties) {
this.buildProperties = buildProperties;
}
@Bean
public OpenAPI defineOpenAPI() {
@ -25,7 +37,7 @@ public class OpenAPIConfiguration {
Info info = new Info();
info.setTitle("Minecraft Utilities API");
info.setVersion("1.0");
info.setVersion(buildProperties == null ? "N/A" : buildProperties.getVersion());
info.setDescription("Wrapper for the Minecraft APIs to make them easier to use.");
info.setContact(contact);
info.setLicense(new License().name("MIT License").url("https://opensource.org/licenses/MIT"));