How to pass an environment variable to a process running as mvn jetty: run?

The process started by the maven consoles plugin ignores any environment variables that I specify. So far, I have been trying to add a variable through the command line, for example:

set myvariable=1 

I also tried adding something like "-Dmyvariable = 1" to the MAVEN_OPTS variable.

Nothing helps.
To be clear, I need to pass the variable not to maven, but to the resulting process, that is, directly to the berth server.

+4
source share
1 answer

You need to specify the systemProperties section in the plugin configuration:

 <project> ... <plugins> ... <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <configuration> ... <systemProperties> <systemProperty> <name>myvariable</name> <value>1</value> </systemProperty> ... </systemProperties> </configuration> </plugin> </plugins> </project> 
+3
source

Source: https://habr.com/ru/post/1440853/


All Articles