How to add program arguments for maven command-line project in intellij?

I am new to intellij. I would like to add program arguments for my maven command-line application so that they can be used in a method main(String[] args), for example:, -pg 541which indicates some method that will be launched in my main function.

I tried to do this using the Maven configuration (Run / Debug Configurations), adding the arguments directly to the command line section, but this failed.

I also tried JUnit, which launches the Maven project, but the program options section is disabled.

Here is a snapshot of what I tried.

using unit configuration:

using junit configuration

using maven configuration:

using maven configuration

+4
1

JUnit , main JUnit, .

main, Application Run/Debug configuration IDEA.

, " VM", -Dparam=value, String value = System.getProperty("param");

Maven argLine unit test.

+4

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


All Articles