Skip to content

Commit 525f1e9

Browse files
Initial commit
0 parents  commit 525f1e9

30 files changed

Lines changed: 2034 additions & 0 deletions

.editorconfig

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
tab_width = 4
6+
indent_size = 4
7+
indent_style = space
8+
max_line_length = 120
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[{*.kt,*.kts}]
13+
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
14+
15+
ij_kotlin_imports_layout = *
16+
ij_kotlin_packages_to_use_import_on_demand = unset
17+
ij_kotlin_name_count_to_use_star_import = 999
18+
ij_kotlin_name_count_to_use_star_import_for_members = 999
19+
20+
[*.java]
21+
ij_java_imports_layout = *, $*
22+
ij_java_packages_to_use_import_on_demand = ""
23+
ij_java_class_count_to_use_import_on_demand = 999
24+
ij_java_names_count_to_use_import_on_demand = 999
25+
26+
[*.{bat,cmd,ps1}]
27+
end_of_line = crlf
28+
29+
[*.sh]
30+
end_of_line = lf
31+
32+
[*.md]
33+
trim_trailing_whitespace = false
34+
35+
[*.{yml,yaml,ksy}]
36+
indent_size = 2

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.bat text eol=crlf
2+
*.cmd text eol=crlf
3+
*.ps1 text eol=crlf
4+
*.sh text eol=lf

.github/workflows/build.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: Build
11+
permissions:
12+
contents: read
13+
packages: write
14+
pull-requests: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-java@v4
19+
with:
20+
java-version: '23'
21+
distribution: 'temurin'
22+
cache: maven
23+
24+
- name: maven build
25+
run: mvn verify
26+
27+
- id: jacoco
28+
uses: madrapps/jacoco-report@v1.7.1
29+
if: ( github.event_name != 'workflow_dispatch' )
30+
with:
31+
paths: ${{ github.workspace }}/report/target/site/jacoco/jacoco.xml
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
min-coverage-overall: 30
34+
min-coverage-changed-files: 30
35+
title: Code Coverage
36+
update-comment: true
37+
38+
linter:
39+
name: linter
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: read
43+
packages: write
44+
pull-requests: write
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-java@v4
49+
with:
50+
java-version: '23'
51+
distribution: 'temurin'
52+
cache: maven
53+
54+
- run: mvn compile -am spotless:check modernizer:modernizer spotbugs:check pmd:check pmd:cpd-check

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
### Project ##
2+
!**/src/main/**
3+
!**/src/test/**
4+
5+
### Maven ###
6+
!.mvn/wrapper/maven-wrapper.jar
7+
target/
8+
.flattened-pom.xml
9+
dependency-reduced-pom.xml
10+
11+
### IntelliJ IDEA ###
12+
!.idea/codeStyles/Project.xml
13+
!.idea/jsonSchemas.xml
14+
.idea/
15+
*.iws
16+
*.iml
17+
*.ipr
18+
19+
### Scala SBT
20+
.bsp
21+
22+
### log files ###
23+
*.log
24+
hs_err_pid*

.mvn/jvm.config

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-Xms512m
2+
-Xmx2048m
3+
-XX:+EnableDynamicAgentLoading
4+
-Djava.awt.headless=true
5+
-Duser.country=US
6+
-Duser.language=en
7+
-Dfile.encoding=UTF-8
8+
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
9+
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
10+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
11+
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
12+
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
13+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
14+
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
15+
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
16+
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
17+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

.mvn/maven.config

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-Duser.timezone=UTC
2+
-Dorg.slf4j.simpleLogger.showDateTime=true
3+
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
4+
--batch-mode
5+
--no-transfer-progress
6+
--errors
7+
--fail-at-end
8+
--show-version
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip

HELP.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Шаблон Java-проекта для домашних заданий
2+
3+
Шаблон для домашних заданий Академии Бэкенда 2025.
4+
5+
## Структура проекта
6+
7+
Это типовой Java-проект, который собирается с помощью инструмента автоматической
8+
сборки проектов [Apache Maven](https://maven.apache.org/).
9+
10+
Проект состоит из следующих директорий и файлов:
11+
12+
- [pom.xml](./pom.xml) – дескриптор сборки, используемый maven, или Project
13+
Object Model. В нем описаны зависимости проекта и шаги по его сборке
14+
- [src/](./src) – директория, которая содержит исходный код приложения и его
15+
тесты:
16+
- src/main – здесь находится код вашего приложения
17+
- src/test – здесь находятся тесты вашего приложения
18+
- [mvnw](./mvnw) и [mvnw.cmd](./mvnw.cmd) – скрипты maven wrapper для Unix и
19+
Windows, которые позволяют запускать команды maven без локальной установки
20+
- [pmd.xml](pmd.xml) и [spotbugs-excludes.xml](spotbugs-excludes.xml) – в проекте
21+
- используются [линтеры](https://en.wikipedia.org/wiki/Lint_%28software%29) для контроля
22+
качества кода. Указанные файлы содержат правила для используемых линтеров
23+
- [.mvn/](./.mvn) – служебная директория maven, содержащая конфигурационные
24+
параметры сборщика
25+
- [lombok.config](lombok.config) – конфигурационный файл
26+
[Lombok](https://projectlombok.org/), библиотеки помогающей избежать рутинного
27+
написания шаблонного кода
28+
- [.editorconfig](.editorconfig) – файл с описанием настроек форматирования кода
29+
- [.github/workflows/build.yml](.github/workflows/build.yaml) – файл с описанием
30+
шагов сборки проекта в среде Github
31+
- [.gitattributes](.gitattributes), [.gitignore](.gitignore) – служебные файлы
32+
для git, с описанием того, как обрабатывать различные файлы, и какие из них
33+
игнорировать
34+
35+
## Начало работы
36+
37+
Для того чтобы собрать проект, и проверить, что все работает корректно, можно
38+
запустить из модального окна IDEA
39+
[Run Anything](https://www.jetbrains.com/help/idea/running-anything.html)
40+
команду:
41+
42+
```shell
43+
mvn clean verify
44+
```
45+
46+
Альтернативно можно в терминале из корня проекта выполнить следующие команды.
47+
48+
Для Unix (Linux, macOS, Cygwin, WSL):
49+
50+
```shell
51+
./mvnw clean verify
52+
```
53+
54+
Для Windows:
55+
56+
```shell
57+
mvnw.cmd clean verify
58+
```
59+
60+
Для окончания сборки потребуется подождать какое-то время, пока maven скачает
61+
все необходимые зависимости, скомпилирует проект и прогонит базовый набор
62+
тестов.
63+
64+
Если вы в процессе сборки получили ошибку:
65+
66+
```shell
67+
Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion failed with message:
68+
JDK version must be at least 23
69+
```
70+
71+
Значит, версия вашего JDK ниже 23.
72+
73+
Если же получили ошибку:
74+
75+
```shell
76+
Rule 1: org.apache.maven.enforcer.rules.version.RequireMavenVersion failed with message:
77+
Maven version should, at least, be 3.8.8
78+
```
79+
80+
Значит, у вас используется версия maven ниже 3.8.8. Такого не должно произойти,
81+
если вы запускаете сборку из IDEA или через `mvnw`-скрипты.
82+
83+
Далее будут перечислены другие полезные команды maven.
84+
85+
Для автоматического форматирования кода используйте команду:
86+
87+
```shell
88+
mvn spotless:apply
89+
```
90+
91+
Запуск только компиляции основных классов:
92+
93+
```shell
94+
mvn compile
95+
```
96+
97+
Запуск тестов:
98+
99+
```shell
100+
mvn test
101+
```
102+
103+
Запуск линтеров:
104+
105+
```shell
106+
mvn clean compile -am spotless:check modernizer:modernizer spotbugs:check pmd:check pmd:cpd-check
107+
```
108+
109+
Вывод дерева зависимостей проекта (полезно при отладке транзитивных
110+
зависимостей):
111+
112+
```shell
113+
mvn dependency:tree
114+
```
115+
116+
Вывод вспомогательной информации о любом плагине (вместо `compiler` можно
117+
подставить интересующий вас плагин):
118+
119+
```shell
120+
mvn help:describe -Dplugin=compiler
121+
```
122+
123+
## Дополнительные материалы
124+
125+
- Документация по maven: https://maven.apache.org/guides/index.html
126+
- Поиск зависимостей и их версий: https://central.sonatype.com/search
127+
- Документация по процессу автоматизированной сборки в среде github:
128+
https://docs.github.com/en/actions
129+
- Документация по git: https://git-scm.com/doc
130+
- Javadoc для Java 23:
131+
https://docs.oracle.com/en/java/javase/23/docs/api/index.html
132+
133+
# Стандартная справка Spring
134+
135+
# Getting Started
136+
137+
### Reference Documentation
138+
139+
For further reference, please consider the following sections:
140+
141+
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
142+
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/3.4.2/maven-plugin)
143+
* [Create an OCI image](https://docs.spring.io/spring-boot/3.4.2/maven-plugin/build-image.html)
144+
* [Distributed Tracing Reference Guide](https://docs.micrometer.io/tracing/reference/index.html)
145+
* [Getting Started with Distributed Tracing](https://docs.spring.io/spring-boot/3.4.2/reference/actuator/tracing.html)
146+
* [Spring Boot Testcontainers support](https://docs.spring.io/spring-boot/3.4.2/reference/testing/testcontainers.html#testing.testcontainers)
147+
* [Testcontainers Kafka Modules Reference Guide](https://java.testcontainers.org/modules/kafka/)
148+
* [Testcontainers Postgres Module Reference Guide](https://java.testcontainers.org/modules/databases/postgres/)
149+
* [Spring Boot Actuator](https://docs.spring.io/spring-boot/3.4.2/reference/actuator/index.html)
150+
* [Spring Configuration Processor](https://docs.spring.io/spring-boot/3.4.2/specification/configuration-metadata/annotation-processor.html)
151+
* [Spring Data JDBC](https://docs.spring.io/spring-boot/3.4.2/reference/data/sql.html#data.sql.jdbc)
152+
* [Spring Data JPA](https://docs.spring.io/spring-boot/3.4.2/reference/data/sql.html#data.sql.jpa-and-spring-data)
153+
* [Spring Data Redis (Access+Driver)](https://docs.spring.io/spring-boot/3.4.2/reference/data/nosql.html#data.nosql.redis)
154+
* [JDBC API](https://docs.spring.io/spring-boot/3.4.2/reference/data/sql.html)
155+
* [Spring for Apache Kafka](https://docs.spring.io/spring-boot/3.4.2/reference/messaging/kafka.html)
156+
* [Liquibase Migration](https://docs.spring.io/spring-boot/3.4.2/how-to/data-initialization.html#howto.data-initialization.migration-tool.liquibase)
157+
* [Prometheus](https://docs.spring.io/spring-boot/3.4.2/reference/actuator/metrics.html#actuator.metrics.export.prometheus)
158+
* [Testcontainers](https://java.testcontainers.org/)
159+
* [Validation](https://docs.spring.io/spring-boot/3.4.2/reference/io/validation.html)
160+
* [Spring Web](https://docs.spring.io/spring-boot/3.4.2/reference/web/servlet.html)
161+
* [Spring Reactive Web](https://docs.spring.io/spring-boot/3.4.2/reference/web/reactive.html)
162+
163+
### Guides
164+
165+
The following guides illustrate how to use some features concretely:
166+
167+
* [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/)
168+
* [Using Spring Data JDBC](https://github.com/spring-projects/spring-data-examples/tree/master/jdbc/basics)
169+
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
170+
* [Messaging with Redis](https://spring.io/guides/gs/messaging-redis/)
171+
* [Accessing Relational Data using JDBC with Spring](https://spring.io/guides/gs/relational-data-access/)
172+
* [Managing Transactions](https://spring.io/guides/gs/managing-transactions/)
173+
* [Validation](https://spring.io/guides/gs/validating-form-input/)
174+
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
175+
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
176+
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
177+
* [Building a Reactive RESTful Web Service](https://spring.io/guides/gs/reactive-rest-service/)
178+
179+
### Testcontainers support
180+
181+
This project
182+
uses [Testcontainers at development time](https://docs.spring.io/spring-boot/3.4.2/reference/features/dev-services.html#features.dev-services.testcontainers).
183+
184+
Testcontainers has been configured to use the following Docker images:
185+
186+
* [`apache/kafka-native:3.8.1`](https://hub.docker.com/r/apache/kafka-native)
187+
* [`postgres:17-alpine`](https://hub.docker.com/_/postgres)
188+
* [`redis:7-alpine`](https://hub.docker.com/_/redis)
189+
190+
Please review the tags of the used images and set them to the same as you're running in production.
191+
192+
### Maven Parent overrides
193+
194+
Due to Maven's design, elements are inherited from the parent POM to the project POM.
195+
While most of the inheritance is fine, it also inherits unwanted elements like `<license>` and `<developers>` from the
196+
parent.
197+
To prevent this, the project POM contains empty overrides for these elements.
198+
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
![Build](https://github.com/central-university-dev/backend-academy-2025-spring-template/actions/workflows/build.yaml/badge.svg)
2+
3+
# Link Tracker
4+
5+
<!-- этот файл можно и нужно менять -->
6+
7+
Проект сделан в рамках курса Академия Бэкенда.
8+
9+
Приложение для отслеживания обновлений контента по ссылкам.
10+
При появлении новых событий отправляется уведомление в Telegram.
11+
12+
Проект написан на `Java 23` с использованием `Spring Boot 3`.
13+
14+
Проект состоит из 2-х приложений:
15+
* Bot
16+
* Scrapper
17+
18+
Для работы требуется БД `PostgreSQL`. Присутствует опциональная зависимость на `Kafka`.
19+
20+
Для дополнительной справки: [HELP.md](./HELP.md)

0 commit comments

Comments
 (0)