Skip to content

Commit b716a70

Browse files
bamsematsfmazmz
andauthored
Update to fix yaml error in pom and README.md content (#65)
* Add Maven Shade Plugin for building a fat JAR; update README with detailed project overview and usage instructions * Update project version to 1.0.2-beta in pom.xml * Update README to reflect fat JAR packaging using Maven Shade Plugin * fix: specify final jar name so the DockerBuild picks the correct one, rollback pom version * rollback POM version to original * update README with dynamic tag and correct port number * update README with the dynamic specified jar file generated from maven-shaded --------- Co-authored-by: WHITEROSE <firasmoussa60@gmail.com>
1 parent 9823160 commit b716a70

4 files changed

Lines changed: 415 additions & 45 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,18 @@ docker pull ghcr.io/ithsjava25/project-webserver-juv25d:latest
131131
## Step 3 – Run the container
132132

133133
```bash
134-
docker run -p 3000:3000 ghcr.io/ithsjava25/project-webserver-juv25d:latest
134+
docker run -p 8080:8080 ghcr.io/ithsjava25/project-webserver-juv25d:latest
135135
```
136136

137137
---
138138

139139
## Step 4 – Open in browser
140140

141141
```
142-
http://localhost:3000
142+
http://localhost:8080
143143
```
144144

145-
The server runs on port **3000**.
145+
The server runs on port **8080**.
146146

147147
---
148148

@@ -160,10 +160,10 @@ org.juv25d.App
160160
3. Open:
161161

162162
```
163-
http://localhost:3000
163+
http://localhost:8080
164164
```
165165

166-
Note: Running the packaged JAR directly with `java -jar` is not supported, as the project is not built as a fat JAR (external dependencies such as SnakeYAML are not bundled).
166+
Note: The project is packaged as a fat JAR using the Maven Shade Plugin, so you can run it with `java -jar target/app.jar`.
167167

168168
---
169169

@@ -327,7 +327,7 @@ Example:
327327

328328
```yaml
329329
server:
330-
port: 3000
330+
port: 8080
331331
root-dir: static
332332

333333
logging:

pom.xml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.juv25d</groupId>
88
<artifactId>JavaHttpServer</artifactId>
9-
<version>1.0.0-beta</version>
9+
<version>1.0-SNAPSHOT</version>
1010

1111
<properties>
1212
<maven.compiler.release>25</maven.compiler.release>
@@ -58,19 +58,6 @@
5858
<artifactId>maven-install-plugin</artifactId>
5959
<version>3.1.4</version>
6060
</plugin>
61-
<plugin>
62-
<groupId>org.apache.maven.plugins</groupId>
63-
<artifactId>maven-jar-plugin</artifactId>
64-
<version>3.5.0</version>
65-
<configuration>
66-
<archive>
67-
<manifest>
68-
<addClasspath>true</addClasspath>
69-
<mainClass>org.juv25d.App</mainClass>
70-
</manifest>
71-
</archive>
72-
</configuration>
73-
</plugin>
7461
<plugin>
7562
<groupId>org.apache.maven.plugins</groupId>
7663
<artifactId>maven-resources-plugin</artifactId>
@@ -171,6 +158,29 @@
171158
</targetTests>
172159
</configuration>
173160
</plugin>
161+
<plugin>
162+
<groupId>org.apache.maven.plugins</groupId>
163+
<artifactId>maven-shade-plugin</artifactId>
164+
<version>3.5.1</version>
165+
<executions>
166+
<execution>
167+
<phase>package</phase>
168+
<goals>
169+
<goal>shade</goal>
170+
</goals>
171+
<configuration>
172+
<finalName>app</finalName>
173+
<shadedArtifactAttached>false</shadedArtifactAttached>
174+
<createDependencyReducedPom>false</createDependencyReducedPom>
175+
<transformers>
176+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
177+
<mainClass>org.juv25d.App</mainClass>
178+
</transformer>
179+
</transformers>
180+
</configuration>
181+
</execution>
182+
</executions>
183+
</plugin>
174184
</plugins>
175185
</build>
176186
</project>

src/main/java/org/juv25d/plugin/StaticFilesPlugin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ public void handle(HttpRequest request, HttpResponse response) throws IOExceptio
2929
response.setBody(staticResponse.body());
3030
}
3131
}
32+

0 commit comments

Comments
 (0)