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_azdsbranch 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, addCOPYlines 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/targetto 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.jarto 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, addCOPYlines 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_azdsbranch 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, addCOPYlines below for all the modules:COPY module1/pom.xml ./module1/ COPY module2/pom.xml ./module2/ -
Create a
run.shas the build script similar to https://github.com/andxu/samples/blob/andy_azds/multi-module-test/run.sh, you need tomvn installfirst orelse themvn assembly:singlewill fail. -
At line 10, update the build command
"mvn", "package"to./run.sh -
At line 13, update the
--from=build /usr/src/app/targetto 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.jarto 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, addCOPYlines 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.yamland update the line 31 from- [mvn, package]to- [./run.sh]