Skip to content

Commit

Permalink
refactor: improve build
Browse files Browse the repository at this point in the history
by pointing the distDir in the frontend app straigth to maven's target/classes/static - folder
  • Loading branch information
saku-koodari committed Sep 11, 2024
1 parent 1021fc2 commit 510ca95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jonka asentamisen jälkeen IDEA:n voi laittaa formatoimaan tallentamisen yhteyde
# Tarkista formatointi. Voit formatoida koodin ajamalla `ktlint --format`
ktlint

# paketoi projektin. Tämä myöskin kopioi node-resurssit target/staticin alle
# paketoi projektin.
mvn package

# Voit käyttää tätä jos ajat ympäristöä terminaalin kautta§§
# Voit käyttää tätä jos ajat ympäristöä terminaalin kautta
./mvnw spring-boot:run
```
3 changes: 3 additions & 0 deletions frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const nextConfig = {
// https://nextjs.org/docs/app/building-your-application/deploying/static-exports
output: "export",

// point the files straight to maven's target files.
distDir: "../target/classes/static",

// The build fails without this.
images: {
unoptimized: true
Expand Down
32 changes: 0 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,6 @@

</executions>
</plugin>

<!-- Resources Plugin to copy React build files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-react-build</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/static</outputDirectory>
<resources>
<resource>
<directory>${frontendDir}/out</directory>
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>




</plugins>
</build>

Expand Down

0 comments on commit 510ca95

Please sign in to comment.