I am trying to run a maven project from a python script. I have installed apache maven.
Running the command: mvn exec:java -D"exec.mainClass"="org.matsim.project.RunMatsim"
from terminal in the project folder where the pom.xml is, creates no errors and the project runs correctly.
But when running the following code from my python script
import subprocess as sp
def execute(cmd):
popen = sp.Popen(cmd, stdout=sp.PIPE, universal_newlines=True,shell=True)
for stdout_line in iter(popen.stdout.readline, ""):
yield stdout_line
popen.stdout.close()
return_code = popen.wait()
if return_code:
raise sp.CalledProcessError(return_code, cmd)
for path in execute(["mvn", "exec:java" ,'-D"exec.mainClass"="org.matsim.project.MatsimRun"']):
print(path, end="")
I got the following error:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify`
Why this is the case? What could be wrong?
The occurred warnings are the same for both cases (terminal, python script).