Skip to content

Commit 3246358

Browse files
committed
Extremely simplified webissues project
0 parents  commit 3246358

11 files changed

Lines changed: 558 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
28+
- name: Detect build system and build
29+
run: |
30+
if [ -f pom.xml ]; then
31+
echo "BUILD_SYSTEM=maven" >> $GITHUB_ENV
32+
mvn -B clean compile -Dmaven.test.skip=true -Djava.awt.headless=true || true
33+
elif [ -f build.gradle ] || [ -f build.gradle.kts ]; then
34+
echo "BUILD_SYSTEM=gradle" >> $GITHUB_ENV
35+
chmod +x gradlew 2>/dev/null || true
36+
if [ -f gradlew ]; then
37+
./gradlew build -x test || true
38+
else
39+
gradle build -x test || true
40+
fi
41+
else
42+
echo "BUILD_SYSTEM=javac" >> $GITHUB_ENV
43+
echo "No Maven/Gradle found, compiling .java files directly"
44+
find . -name "*.java" -not -path "*/test/*" | head -50 | xargs javac -d /tmp/classes 2>&1 | tail -20 || true
45+
fi
46+
47+
- name: Run tests
48+
run: |
49+
if [ "$BUILD_SYSTEM" = "maven" ]; then
50+
mvn -B test jacoco:report -Djava.awt.headless=true || true
51+
elif [ "$BUILD_SYSTEM" = "gradle" ]; then
52+
if [ -f gradlew ]; then
53+
./gradlew test jacocoTestReport || true
54+
else
55+
gradle test jacocoTestReport || true
56+
fi
57+
else
58+
echo "No test runner configured"
59+
fi
60+
61+
- name: Show coverage summary
62+
run: |
63+
# Maven JaCoCo
64+
if [ -f target/site/jacoco/jacoco.csv ]; then
65+
echo "## Test Coverage Report (JaCoCo)" >> $GITHUB_STEP_SUMMARY
66+
echo '```' >> $GITHUB_STEP_SUMMARY
67+
awk -F',' 'NR>1 {missed+=$4; covered+=$5} END {total=missed+covered; if(total>0) printf "Line Coverage: %d/%d (%.1f%%)\nMissed: %d lines\n", covered, total, covered*100/total, missed; else print "No coverage data"}' target/site/jacoco/jacoco.csv >> $GITHUB_STEP_SUMMARY
68+
echo '```' >> $GITHUB_STEP_SUMMARY
69+
# Gradle JaCoCo
70+
elif [ -f build/reports/jacoco/test/jacocoTestReport.csv ]; then
71+
echo "## Test Coverage Report (JaCoCo)" >> $GITHUB_STEP_SUMMARY
72+
echo '```' >> $GITHUB_STEP_SUMMARY
73+
awk -F',' 'NR>1 {missed+=$4; covered+=$5} END {total=missed+covered; if(total>0) printf "Line Coverage: %d/%d (%.1f%%)\nMissed: %d lines\n", covered, total, covered*100/total, missed; else print "No coverage data"}' build/reports/jacoco/test/jacocoTestReport.csv >> $GITHUB_STEP_SUMMARY
74+
echo '```' >> $GITHUB_STEP_SUMMARY
75+
else
76+
echo "## Coverage" >> $GITHUB_STEP_SUMMARY
77+
echo "No JaCoCo report found. Add jacoco-maven-plugin or jacoco Gradle plugin." >> $GITHUB_STEP_SUMMARY
78+
fi
79+
80+
- name: Upload coverage to Codecov
81+
if: hashFiles('**/jacoco.xml') != ''
82+
uses: codecov/codecov-action@v4
83+
with:
84+
fail_ci_if_error: false
85+
env:
86+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/nbactions.xml
2+
/nb-configuration.xml.idea

CLAUDE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# webissues_simple — Extremely simplified webissues project
2+
3+
## About
4+
5+
Extremely simplified webissues project
6+
7+
## Prerequisites
8+
9+
- JDK 8+
10+
- Maven 3.x
11+
12+
## Build & Run
13+
14+
```bash
15+
mvn clean install
16+
mvn test
17+
```
18+
19+
## Development Guidelines
20+
21+
### Code Style
22+
- Follow standard Java conventions
23+
- Keep code clean and well-organized
24+
- Use meaningful variable and method names
25+
26+
### Git Workflow
27+
- Write clear, descriptive commit messages
28+
- One logical change per commit
29+
- Test before committing
30+
31+
### Testing
32+
- Write tests for new functionality
33+
- Run the full test suite before pushing
34+
- Keep tests focused and independent

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
webissues
2+
=========
3+
4+
Simple spring-based web application. Tested with Apache Tomcat 7.0.40.
5+

pom.xml

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>ru.spb.petrk</groupId>
6+
<artifactId>webissues</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>war</packaging>
9+
10+
<name>webissues</name>
11+
12+
<properties>
13+
<spring.version>6.2.6</spring.version>
14+
<spring.security.version>6.4.4</spring.security.version>
15+
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>javax.servlet</groupId>
23+
<artifactId>jstl</artifactId>
24+
<version>1.2</version>
25+
</dependency>
26+
27+
<dependency>
28+
<groupId>org.glassfish.web</groupId>
29+
<artifactId>jstl-impl</artifactId>
30+
<version>1.2</version>
31+
<exclusions>
32+
<exclusion>
33+
<artifactId>servlet-api</artifactId>
34+
<groupId>javax.servlet</groupId>
35+
</exclusion>
36+
<exclusion>
37+
<artifactId>jsp-api</artifactId>
38+
<groupId>javax.servlet.jsp</groupId>
39+
</exclusion>
40+
<exclusion>
41+
<artifactId>jstl-api</artifactId>
42+
<groupId>javax.servlet.jsp.jstl</groupId>
43+
</exclusion>
44+
</exclusions>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>javax</groupId>
49+
<artifactId>javaee-web-api</artifactId>
50+
<version>6.0</version>
51+
<scope>provided</scope>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>org.springframework</groupId>
56+
<artifactId>spring-core</artifactId>
57+
<version>${spring.version}</version>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>org.springframework</groupId>
62+
<artifactId>spring-context</artifactId>
63+
<version>${spring.version}</version>
64+
</dependency>
65+
66+
<dependency>
67+
<groupId>org.springframework</groupId>
68+
<artifactId>spring-beans</artifactId>
69+
<version>${spring.version}</version>
70+
</dependency>
71+
72+
<dependency>
73+
<groupId>org.springframework.security</groupId>
74+
<artifactId>spring-security-core</artifactId>
75+
<version>${spring.security.version}</version>
76+
</dependency>
77+
78+
<dependency>
79+
<groupId>org.springframework.security</groupId>
80+
<artifactId>spring-security-web</artifactId>
81+
<version>${spring.security.version}</version>
82+
</dependency>
83+
84+
<dependency>
85+
<groupId>org.springframework.security</groupId>
86+
<artifactId>spring-security-config</artifactId>
87+
<version>${spring.security.version}</version>
88+
</dependency>
89+
90+
<dependency>
91+
<groupId>org.springframework.security</groupId>
92+
<artifactId>spring-security-taglibs</artifactId>
93+
<version>${spring.security.version}</version>
94+
</dependency>
95+
96+
<dependency>
97+
<groupId>org.springframework</groupId>
98+
<artifactId>spring-web</artifactId>
99+
<version>${spring.version}</version>
100+
</dependency>
101+
102+
<dependency>
103+
<groupId>org.springframework</groupId>
104+
<artifactId>spring-webmvc</artifactId>
105+
<version>${spring.version}</version>
106+
</dependency>
107+
108+
<dependency>
109+
<groupId>org.springframework</groupId>
110+
<artifactId>spring-orm</artifactId>
111+
<version>${spring.version}</version>
112+
</dependency>
113+
114+
<dependency>
115+
<groupId>org.springframework.data</groupId>
116+
<artifactId>spring-data-jpa</artifactId>
117+
<version>[1.11.22,)</version>
118+
</dependency>
119+
120+
<dependency>
121+
<groupId>org.hibernate</groupId>
122+
<artifactId>hibernate-core</artifactId>
123+
<version>3.6.10.Final</version>
124+
</dependency>
125+
126+
<dependency>
127+
<groupId>org.hibernate</groupId>
128+
<artifactId>hibernate-entitymanager</artifactId>
129+
<version>3.6.10.Final</version>
130+
<exclusions>
131+
<exclusion>
132+
<groupId>cglib</groupId>
133+
<artifactId>cglib</artifactId>
134+
</exclusion>
135+
<exclusion>
136+
<groupId>dom4j</groupId>
137+
<artifactId>dom4j</artifactId>
138+
</exclusion>
139+
</exclusions>
140+
</dependency>
141+
142+
<dependency>
143+
<groupId>org.hibernate</groupId>
144+
<artifactId>hibernate-ehcache</artifactId>
145+
<version>3.6.10.Final</version>
146+
</dependency>
147+
148+
<dependency>
149+
<groupId>org.javassist</groupId>
150+
<artifactId>javassist</artifactId>
151+
<version>3.17.1-GA</version>
152+
</dependency>
153+
154+
<dependency>
155+
<groupId>mysql</groupId>
156+
<artifactId>mysql-connector-java</artifactId>
157+
<version>5.1.49</version>
158+
<scope>runtime</scope>
159+
</dependency>
160+
161+
</dependencies>
162+
163+
<build>
164+
<plugins>
165+
<plugin>
166+
<groupId>org.apache.maven.plugins</groupId>
167+
<artifactId>maven-compiler-plugin</artifactId>
168+
<version>2.3.2</version>
169+
<configuration>
170+
<source>1.6</source>
171+
<target>1.6</target>
172+
<compilerArguments>
173+
<endorseddirs>${endorsed.dir}</endorseddirs>
174+
</compilerArguments>
175+
</configuration>
176+
</plugin>
177+
<plugin>
178+
<groupId>org.apache.maven.plugins</groupId>
179+
<artifactId>maven-war-plugin</artifactId>
180+
<version>2.3</version>
181+
<configuration>
182+
<failOnMissingWebXml>false</failOnMissingWebXml>
183+
</configuration>
184+
</plugin>
185+
<plugin>
186+
<groupId>org.apache.maven.plugins</groupId>
187+
<artifactId>maven-dependency-plugin</artifactId>
188+
<version>2.1</version>
189+
<executions>
190+
<execution>
191+
<phase>validate</phase>
192+
<goals>
193+
<goal>copy</goal>
194+
</goals>
195+
<configuration>
196+
<outputDirectory>${endorsed.dir}</outputDirectory>
197+
<silent>true</silent>
198+
<artifactItems>
199+
<artifactItem>
200+
<groupId>javax</groupId>
201+
<artifactId>javaee-endorsed-api</artifactId>
202+
<version>6.0</version>
203+
<type>jar</type>
204+
</artifactItem>
205+
</artifactItems>
206+
</configuration>
207+
</execution>
208+
</executions>
209+
</plugin>
210+
</plugins>
211+
</build>
212+
213+
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package ru.spb.petrk.webissues.controller;
6+
7+
import org.springframework.stereotype.Controller;
8+
import org.springframework.web.bind.annotation.RequestMapping;
9+
import org.springframework.web.bind.annotation.RequestMethod;
10+
import org.springframework.web.servlet.ModelAndView;
11+
import ru.spb.petrk.webissues.model.Car;
12+
13+
import jakarta.servlet.http.HttpServletRequest;
14+
15+
16+
/**
17+
*
18+
* @author PetrK
19+
*/
20+
21+
@Controller
22+
public class ApplicationController {
23+
24+
@RequestMapping(value = {"/app/", "/app/index"}, method = RequestMethod.GET)
25+
public String index() {
26+
return "index";
27+
}
28+
29+
@RequestMapping(value = {"/app/car"}, method = RequestMethod.GET)
30+
public String getCar(HttpServletRequest request) {
31+
request.getSession(true).setAttribute("car", new Car("BMW", 300));
32+
return "index";
33+
}
34+
35+
private ApplicationController() {}
36+
}

0 commit comments

Comments
 (0)