This is a Java 21 + Scala 3 web application (WAR) for Linux.org.ru. It uses Maven for build, Spring Framework, and includes both unit and integration tests.
Project uses PostgreSQL 16 database, Opensearch 3.x for full text seach and analytics. It contains embedded ActiveMQ.
mvn package -DskipTests # Build WAR without running tests
mvn compile # Compile main sources only
mvn test-compile # Compile main and test sourcesRun all unit tests only (no integration tests):
mvn testRun a single test class:
mvn test -Dtest=StringUtilTest
mvn test -Dtest=ru.org.linux.util.StringUtilTestRun a single test method:
mvn test -Dtest=StringUtilTest#processTitleRun integration tests:
mvn integration-test Run a single integration test:
mvn integration-test -Dit.test=TopicControllerIntegrationTestRun all tests (unit + integration):
mvn verifyRun in background shell:
mvn -DskipTests package jetty:run-war > server.log 2>&1 &Important: The development web server must be restarted after any changes to the code.
Stop server with:
mvn jetty:stopServer starts at http://127.0.0.1:8080/
All users in test development database has password 'passwd'. Use following users for testing:
- maxcom: administrator, full permissions
- svu: moderator
- edo: user (score >= 50)
Integration tests and development web server uses pre-installed PostgreSQL at postgresql:///lor.
This project uses Maven-only frontend tooling — no Node.js, npm, or package.json is required.
CSS Pipeline:
- Source:
src/main/webapp/sass/*.scss(Sass source files) dart-sass-maven-plugin(phase:generate-resources) compiles Sass to CSS in compressed styleyuicompressor-maven-plugin(phase:generate-resources) minifies CSS and aggregates per-themecombined.cssbundles.maven-war-pluginexcludes raw source CSS from the final WAR; only minified/aggregated copies are included
JS Pipeline:
- Custom JS source:
src/main/webapp/js/ closure-compiler-maven-plugin(phase:generate-resources/process-resources):- Merges
js/lor/*.jsinto a singlelor.js - Minifies individual files:
add-form.js,lor_view_diff_history.js,realtime.js,tagsAutocomplete.js - Minifies individual plugins:
jquery.hotkeys.js,pattern.js
- Merges
maven-dependency-plugin(phase:generate-sources) unpacks third-party JS libraries from WebJar dependenciesmaven-antrun-plugin(phase:compile) concatenates WebJar libraries intoplugins.js- Pre-minified files are copied as-is
maven-war-pluginexcludes raw source JS from the final WAR; only processed copies are included
mvn clean # Clean target directory
mvn dependency:tree # Show dependency tree- All source files must include the Apache License header (see existing files)
- Maximum line length: 120 characters (enforced by Scalafmt)
- Package structure:
ru.org.linux.*
- Use Spring annotations:
@Repository,@Service,@Controller, etc. - Use
@Nullableand@Nonnullannotations fromjavax.annotation - Use Java 17+ features (records, pattern matching) where appropriate
- Use
Optionalinstead of null returns - Use constructor injection over field injection
- Import order: java., javax., org., com., ru.*
- Follow
.scalafmt.confconfiguration (version 3.10.7, Scala 3 dialect) - Use strict logging:
com.typesafe.scalalogging.StrictLogging - Use Akka/Pekko for async operations
- Use
if then/if then elseinstead ofif () {}/if () {} else {} - Use
matchwith indentation-based syntax instead of curly braces where appropriate - Use
endmarkers for significant indentation blocks when clarity benefits - Prefer
given/usingoverimplicit - Use
extensionmethods instead of implicit classes - Prefer enums over sealed trait hierarchies for ADTs
- Use optional braces (significant indentation) consistently
- Java classes:
CamelCase(e.g.,UserDao,TopicController) - Scala classes/objects:
CamelCase(e.g.,CommentCreateService) - Methods/fields:
camelCase - Java constants:
UPPER_SNAKE_CASE - Scala constants:
UpperCamelCase - Test classes:
*Test,*IntegrationTest,*WebTest.scala
- Use custom exceptions (e.g.,
MessageNotFoundException,UserNotFoundException) - Return
Optional<T>for potentially missing values - Use Spring's
@ExceptionHandlerfor controller-level error handling - Log errors with appropriate levels (error for exceptions, info/debug for flow)
- Use JUnit 4/5 for Java unit tests
- Use MUnit for Scala tests
- Follow AAA pattern (Arrange/Act/Assert or Given/When/Then)
- Place test classes in same package under
src/test/javaorsrc/test/scala - Integration tests require database
- Use ScalikeJDBC
- Connection management and transactions are made by Spring
- Use
SpringDB.runto run SQL with auto commit. UseSpringDB.localTxfor transactions. - Repository pattern with
@Repositoryannotation
- Spring Framework 6.x
- ScalikeJDBC 4.x
- Spring Security 6.x
- PostgreSQL JDBC driver
- OpenSearch 3 via opensearch-java.
- Pekko for async
src/
├── main/
│ ├── java/ru/org/linux/ # Java sources
│ ├── scala/ru/org/linux/ # Scala sources
│ └── webapp/ # Web application root (Maven WAR)
│ ├── js/ # JavaScript source files
│ │ └── lor/ # Modular JS → merged into lor.js
│ ├── sass/ # SASS source files (compiled to CSS)
│ ├── WEB-INF/ # JSP templates, Spring configs, web.xml
│ ├── help/ # Help documentation pages (markdown)
│ ├── img/ # Site images
│ ├── font/ # Web fonts
│ ├── black/ # Theme: Black (ir_black.css + static assets)
│ ├── tango/ # Theme: Tango (syntax.css + static assets)
│ ├── waltz/ # Theme: Waltz (syntax.css + static assets)
│ ├── white2/ # Theme: White2 (idea.css + static assets)
│ ├── zomg_ponies/ # Theme: ZOMG Ponies (static assets)
│ └── qrerror/ # Standalone 502 error page for CDN (self-contained, no external references)
├── test/
│ ├── java/ru/org/linux/ # Java test sources
│ ├── scala/ru/org/linux/ # Scala test sources
│ └── resources/ # Test resources (spring configs, etc.)
- IntelliJ IDEA (has good Scala/Java support)
- For VS Code: Use Java extension with null analysis mode set to "automatic"
- Wait for Approval: Do not commit or push changes without explicit user confirmation.
- Update copyright year in all modified files to 2026
Update this file if the changes you have done are worth updating here. The intent of this file is to give you a rough idea of the project, from where you can explore further, if needed.