Sample maven projects for Azure Dev Spaces
In order to run multiple module project in Azure Dev Spaces, you are now required to perform some additional editing after you run the vscode command Azure Dev Spaces: Prepare configuration files for Azure Dev Spaces
-
Your project should look like
https://github.com/andxu/samples/tree/andy_azds/spring-boot-test
(andy_azds
branch contains the original template files generated by azds) -
Open your project in vscode, and run the vscode command
Azure Dev Spaces: Prepare configuration files for Azure Dev Spaces
-
Open the
Dockerfile
, you would see theCOPY pom.xml .
in line 7, see: https://github.com/andxu/samples/blob/andy_azds/spring-boot-test/Dockerfile#L7, addCOPY
lines below for all the modules:COPY application/pom.xml ./application/ COPY library/pom.xml ./library/
-
At line 13, update the
--from=build /usr/src/app/target
to the spring boot application project like--from=build /usr/src/app/application/target/gs-multi-module-application-0.0.1-SNAPSHOT.jar
-
At line 14, update the wrong jar file
gs-multi-module-0.0.1-SNAPSHOT.jar
to the correct jar likegs-multi-module-application-0.0.1-SNAPSHOT.jar
-
Open the
Dockerfile.develop
, you would see theCOPY pom.xml .
in line 5, see: https://github.com/andxu/samples/blob/andy_azds/spring-boot-test/Dockerfile.develop#L5, addCOPY
lines below for all the modules like:COPY application/pom.xml ./application/ COPY library/pom.xml ./library/
-
At last line, update the wrong jar path
"target/gs-multi-module-0.0.1-SNAPSHOT.jar"
to the correct jar path like"application/target/gs-multi-module-application-0.0.1-SNAPSHOT.jar"
-
Your project should look like
https://github.com/andxu/samples/blob/andy_azds/multi-module-test
(andy_azds
branch contains the original template files generated by azds) -
Open your project in vscode, and run the vscode command
Azure Dev Spaces: Prepare configuration files for Azure Dev Spaces
-
Open the
Dockerfile
, you would see theCOPY pom.xml .
in line 7, see: https://github.com/andxu/samples/blob/andy_azds/multi-module-test/Dockerfile#L7, addCOPY
lines below for all the modules:COPY module1/pom.xml ./module1/ COPY module2/pom.xml ./module2/
-
Create a
run.sh
as the build script similar to https://github.com/andxu/samples/blob/andy_azds/multi-module-test/run.sh, you need tomvn install
first orelse themvn assembly:single
will fail. -
At line 10, update the build command
"mvn", "package"
to./run.sh
-
At line 13, update the
--from=build /usr/src/app/target
to the entry project like--from=build /usr/src/app/module2/target/module2-1.0-jar-with-dependencies.jar
-
At line 14, update the wrong jar file
multi-module-test-1.0.jar
to the correct jar likemodule2-1.0-jar-with-dependencies.jar
-
Open the
Dockerfile.develop
, you would see theCOPY pom.xml .
in line 5, see: https://github.com/andxu/samples/blob/andy_azds/multi-module-test/Dockerfile.develop#L5, addCOPY
lines below for all the modules like:COPY module1/pom.xml ./module1/ COPY module2/pom.xml ./module2/
-
At line 8, update the build command
"mvn", "package"
to./run.sh
-
At last line, update the wrong jar path
"target/multi-module-test-1.0.jar"
to the correct jar path like"module2/target/module2-1.0-jar-with-dependencies.jar"
-
Open the
azds.yaml
and update the line 31 from- [mvn, package]
to- [./run.sh]