'Error when runnning mvn command to deploy dataflow template

Hi I am running the below code to deploy a dataflow template in GCP.

mvn compile exec:java \
       -Dexec.mainClass=com.google.cloud.teleport.templates.TextIOToBigQuery \
       -Dexec.cleanupDaemonThreads=false \
       [-Dexec.args="--runner=DataflowRunner \
         --project=$PROJECT_ID \
         --stagingLocation=gs://bucket/staging \
         --tempLocation=gs://bucket/temp \
         --templateLocation=gs://bucket/templates/writeToBQ.json \
         --region=$DEV_REGION

"] \
       -P dataflow-runner

but I keep getting the below error... I am not sure why it is taking the args as the pom file? I can only assume I am formatting the command wrong... any ideass?

Downloading from central: https://repo.maven.apache.org/maven2/%20%5B-Dexec/args=--runner=DataflowRunner%20%5C%20--project=project%20%5C%20--stagingLocation=gs///bucket/staging%20%5C%20--tempLocation=gs///bucket/temp%20%5C%20--templateLocation=gs///bucket/staging%20%5C%20--tempLocation=gs-//bucket/temp%20%5C%20--templateLocation=gs.pom
[WARNING] The POM for  [-Dexec.args=--runner=DataflowRunner \ --project=Project \ --stagingLocation=gs://bucket/staging \ --tempLocation=gs:jar://bucket/temp \ --templateLocation=gs is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/%20%5B-Dexec/args=--runner=DataflowRunner%20%5C%20--project=project%20%5C%20--stagingLocation=gs///bucket/temp%20%5C%20--templateLocation=gs.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:16 min
[INFO] Finished at: 2022-04-27T09:47:03Z
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin  [-Dexec.args=--runner=DataflowRunner \ --project=project \ --stagingLocation=gs://bucket/staging \ --tempLocation=gs://bucket/temp \ --templateLocation=gs or one of its dependencies could not be resolved: Could not find artifact  [-Dexec.args=--runner=DataflowRunner \ --project=project \ --stagingLocation=gs://bucket/staging \ --tempLocation=gs:jar://bucket/temp \ --templateLocation=gs in central (https://repo.maven.apache.org/maven2) -> [Help 1]


Solution 1:[1]

Can you try removing the square brackets from the command? An example can be found here.

 mvn compile exec:java \
   -Dexec.mainClass=com.example.myclass \
   -Dexec.args="--runner=DataflowRunner \
              --project=PROJECT_ID \
              --stagingLocation=gs://BUCKET_NAME/staging \
              --templateLocation=gs://BUCKET_NAME/templates/TEMPLATE_NAME \
              --region=REGION" \
   -P dataflow-runner

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 ningk