'Why is `mule:deploy` also downloading dependencies, can it be stopped and only deploy?

We are using Azure CI/CD and we are deploying to CloudHub and/or On-Premise using the maven plugin. But each deploy also downloads some dependencies, which takes a lot of time to complete and after the download it really deploys to Mule.

Can we somehow stop this download and only deploy? Which will take less time to complete. We are using 3.5.4 of the mule maven plugin.

The command executed would be: [command]/usr/bin/mvn -f /azp/_work/r1/a/_<APP_NAME> CI/<APP_NAME>/pom.xml -Dmule.artifact=/azp/_work/r1/a/_<APP_NAME> CI/<APP_NAME>/package/<APP_NAME>-<VERSION>-mule-application.jar -Dmulesoft.username=<USER> -Dmulesoft.password=*** -Dmulesoft.application.name=<APP_NAME> -Dmulesoft.environment=<ENV> -Dtarget.type=server -Dtarget.name=<TARGET> -Drevision=<VERSION> -Danypoint.platform.client_id=*** -Danypoint.platform.client_secret=*** -Dmule.env=<ENV> -Danypoint.platform.base_uri=https://anypoint.mulesoft.com/ -Danypoint.platform.analytics_base_uri=https://analytics-ingest.anypoint.mulesoft.com/ -Dmule.key=<KEY> mule:deploy

The output of the command will first start some downloads and afterwards the actual build:

2022-05-13T09:54:30.6391145Z [[1;34mINFO[m] Scanning for projects...
2022-05-13T09:54:31.1181089Z Downloading from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-maven-plugin/3.5.4/mule-maven-plugin-3.5.4.pom
2022-05-13T09:54:32.0477300Z Progress (1): 3.8/5.8 kB
2022-05-13T09:54:32.1507343Z Progress (1): 5.8 kB    
2022-05-13T09:54:32.1565163Z                     
2022-05-13T09:54:32.1567637Z Downloaded from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-maven-plugin/3.5.4/mule-maven-plugin-3.5.4.pom (5.8 kB at 5.5 kB/s)
2022-05-13T09:54:32.1842212Z Downloading from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-artifact-tools/3.5.4/mule-artifact-tools-3.5.4.pom
2022-05-13T09:54:32.2768935Z Progress (1): 3.8/26 kB
2022-05-13T09:54:32.2788361Z Progress (1): 7.8/26 kB
2022-05-13T09:54:32.3599724Z Progress (1): 12/26 kB 
2022-05-13T09:54:32.3660918Z Progress (1): 16/26 kB
2022-05-13T09:54:32.3687672Z Progress (1): 20/26 kB
2022-05-13T09:54:32.3708468Z Progress (1): 24/26 kB
2022-05-13T09:54:32.4659300Z Progress (1): 26 kB   
2022-05-13T09:54:32.4660955Z                    
2022-05-13T09:54:32.4663598Z Downloaded from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-artifact-tools/3.5.4/mule-artifact-tools-3.5.4.pom (26 kB at 92 kB/s)
2022-05-13T09:54:32.4924427Z Downloading from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-packager/3.5.4/mule-packager-3.5.4.pom
2022-05-13T09:54:32.5865328Z Progress (1): 3.8/4.3 kB
2022-05-13T09:54:32.6821126Z Progress (1): 4.3 kB    
2022-05-13T09:54:32.6822832Z                     
2022-05-13T09:54:32.6827017Z Downloaded from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-packager/3.5.4/mule-packager-3.5.4.pom (4.3 kB at 23 kB/s)
2022-05-13T09:54:32.6975910Z Downloading from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-classloader-model/3.5.4/mule-classloader-model-3.5.4.pom
2022-05-13T09:54:32.8797068Z Progress (1): 2.2 kB
2022-05-13T09:54:32.8815459Z                     
2022-05-13T09:54:32.8817163Z Downloaded from mulesoft-releases: https://repository.mulesoft.org/releases/org/mule/tools/maven/mule-classloader-model/3.5.4/mule-classloader-model-3.5.4.pom (2.2 kB at 12 kB/s)
2022-05-13T09:54:32.8918604Z Downloading from mulesoft-releases: https://repository.mulesoft.org/releases/org/apache/commons/commons-lang3/3.10/commons-lang3-3.10.pom
2022-05-13T09:54:33.0002885Z Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.10/commons-lang3-3.10.pom
2022-05-13T09:54:33.0736365Z Progress (1): 2.7/31 kB
2022-05-13T09:54:33.0737447Z Progress (1): 5.5/31 kB
2022-05-13T09:54:33.0737921Z Progress (1): 8.2/31 kB
2022-05-13T09:54:33.0738379Z Progress (1): 11/31 kB 
2022-05-13T09:54:33.0738807Z Progress (1): 14/31 kB
2022-05-13T09:54:33.0739230Z Progress (1): 16/31 kB
2022-05-13T09:54:33.0739672Z Progress (1): 19/31 kB
2022-05-13T09:54:33.0740133Z Progress (1): 21/31 kB
2022-05-13T09:54:33.0740679Z Progress (1): 24/31 kB

<CONTENT REMOVED>

2022-05-13T09:56:03.4534742Z Downloaded from central: https://repo.maven.apache.org/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar (5.8 kB at 3.2 kB/s)
2022-05-13T09:56:03.4536115Z Progress (3): 379 kB | 4.3 kB | 49/55 kB
2022-05-13T09:56:03.4536568Z Progress (3): 379 kB | 4.3 kB | 53/55 kB
2022-05-13T09:56:03.4544561Z Progress (3): 379 kB | 4.3 kB | 55 kB   
2022-05-13T09:56:03.4545335Z                                      
2022-05-13T09:56:03.4546832Z Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar (4.3 kB at 2.4 kB/s)
2022-05-13T09:56:03.4614094Z Downloaded from central: https://repo.maven.apache.org/maven2/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar (379 kB at 208 kB/s)
2022-05-13T09:56:03.4659777Z Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-provider-api/2.12/wagon-provider-api-2.12.jar (55 kB at 30 kB/s)
2022-05-13T09:56:03.9320327Z [[1;33mWARNING[m] 
2022-05-13T09:56:03.9323175Z [[1;33mWARNING[m] Some problems were encountered while building the effective model for com.mycompany:tst-<APP_NAME>:mule-application:<VERSION>
2022-05-13T09:56:03.9325652Z [[1;33mWARNING[m] 'artifactId' contains an expression but should be a constant. @ com.mycompany:${mulesoft.application.name}:${revision}, /azp/_work/r1/a/_<APP_NAME> CI/<APP_NAME>/pom.xml, line 5, column 14
2022-05-13T09:56:03.9326790Z [[1;33mWARNING[m] 
2022-05-13T09:56:03.9327725Z [[1;33mWARNING[m] It is highly recommended to fix these problems because they threaten the stability of your build.
2022-05-13T09:56:03.9328472Z [[1;33mWARNING[m] 
2022-05-13T09:56:03.9329927Z [[1;33mWARNING[m] For this reason, future Maven versions might no longer support building such malformed projects.
2022-05-13T09:56:03.9330768Z [[1;33mWARNING[m] 
2022-05-13T09:56:03.9597427Z [[1;34mINFO[m] 
2022-05-13T09:56:03.9621642Z [[1;34mINFO[m] [1m---------------------< [0;36mcom.mycompany:tst-<APP_NAME>[0;1m >----------------------[m
2022-05-13T09:56:03.9623310Z [[1;34mINFO[m] [1mBuilding tst-<APP_NAME>-app <VERSION>[m
2022-05-13T09:56:03.9624407Z [[1;34mINFO[m] [1m--------------------------[ mule-application ]--------------------------[m
2022-05-13T09:56:03.9660310Z [[1;34mINFO[m] 
2022-05-13T09:56:03.9661604Z [[1;34mINFO[m] [1m--- [0;32mmule-maven-plugin:3.5.4:deploy[m [1m(default-cli)[m @ [36mtst-<APP_NAME>[0;1m ---[m
2022-05-13T09:56:08.8821619Z [[1;34mINFO[m] Deploying artifact tst-<APP_NAME>
2022-05-13T09:56:12.1026652Z [[1;34mINFO[m] Found application tst-<APP_NAME> on server <TARGET>. Redeploying application...
2022-05-13T09:56:55.0711750Z [[1;34mINFO[m] Checking application: tst-<APP_NAME> has started
2022-05-13T09:58:55.9768435Z [[1;34mINFO[m] Artifact tst-<APP_NAME> deployed
2022-05-13T09:58:55.9786077Z [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
2022-05-13T09:58:55.9819571Z [[1;34mINFO[m] [1;32mBUILD SUCCESS[m
2022-05-13T09:58:55.9822166Z [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
2022-05-13T09:58:55.9845817Z [[1;34mINFO[m] Total time:  04:25 min
2022-05-13T09:58:55.9852969Z [[1;34mINFO[m] Finished at: 2022-05-13T09:58:55Z
2022-05-13T09:58:55.9855473Z [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
2022-05-13T09:58:56.0327156Z Code analysis is disabled outside of the build environment. Could not find a value for: build.artifactStagingDirectory
2022-05-13T09:58:56.0411723Z ##[section]Finishing: Maven deploy to Mulesoft


Solution 1:[1]

That's how Maven works. If you just want to deploy an already built Mule application you can look into using Anypoint CLI for the deployment only. However Anypoint CLI will not build the application for you

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aled