Skip to content

Commit

Permalink
JFB 7: Build jar from homework 6.5 using Maven and Gradle (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtemirbulat authored Jul 4, 2024
2 parents 08d7979 + 8128702 commit 542a889
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 23 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build-gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build with Gradle and run
on: [push, workflow_dispatch]

jobs:
build_with_gradle:
runs-on: ubuntu-latest
steps:
- name: Get Repo
uses: actions/[email protected]
- name: Setup Java
uses: actions/[email protected]
with:
java-version: 21
distribution: 'temurin'
- name: Build Project with Gradle
run: gradle clean build
- name: Run Application
run: java -jar build/libs/java-trainee-edu-1.0-SNAPSHOT.jar
19 changes: 19 additions & 0 deletions .github/workflows/build-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build with Maven and run
on: [push, workflow_dispatch]

jobs:
build_with_maven:
runs-on: ubuntu-latest
steps:
- name: Get Repo
uses: actions/[email protected]
- name: Setup Java
uses: actions/[email protected]
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: Build Project with Maven
run: mvn clean package
- name: Run Application
run: java -jar java-trainee-edu/target/java-trainee-edu-1.0-SNAPSHOT.jar
35 changes: 35 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
id 'java'
id 'application'
}

group 'com.rtemi'
version '1.0-SNAPSHOT'

java{
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1'
}

application {
mainClassName = 'com.rtemi.services.CustomDataStructures'
}

jar {
manifest {
attributes(
'Main-Class': 'com.rtemi.services.CustomDataStructures'
)
}

}
30 changes: 29 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,42 @@
<modelVersion>4.0.0</modelVersion>

<groupId>com.rtemi</groupId>
<artifactId>trainee-edu-hw2</artifactId>
<artifactId>java-trainee-edu</artifactId>
<version>1.0-SNAPSHOT</version>

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

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.rtemi.services.CustomDataStructures</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Binary file removed screenshot/Screenshot_4.png
Binary file not shown.
Binary file removed screenshot/busticketvalidator.png
Binary file not shown.
Binary file removed screenshot/resultHW6.png
Binary file not shown.
17 changes: 0 additions & 17 deletions src/main/java/com/rtemi/model/ArrayListImpl.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/com/rtemi/model/ConcertTicket.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ConcertTicket extends TicketUID implements Printable, Shareable {
private static final int WEIGHT_PRECISION = 3;

private String concertTicketId;
@NullableWarning(key = "Variable [concertHall] is null in [Ticket]!")
@NullableWarning(key = "Variable [concertHall] is null in [Ticket]!")
private String concertHall;
private int eventCode;
private long ticketPurchaseTime;
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/rtemi/model/HashSetImpl.java

This file was deleted.

0 comments on commit 542a889

Please sign in to comment.