Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在pom中使用命令行参数?_Java_Maven_Command Line Interface_Pom.xml - Fatal编程技术网

Java 如何在pom中使用命令行参数?

Java 如何在pom中使用命令行参数?,java,maven,command-line-interface,pom.xml,Java,Maven,Command Line Interface,Pom.xml,我有一个多模块的项目,有很多的铃铛和哨子。例如,此插件: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>${maven.exec.version}</v

我有一个多模块的项目,有很多的铃铛和哨子。例如,此插件:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${maven.exec.version}</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>python3</executable>
                            <workingDirectory>src/main/python</workingDirectory>
                            <arguments>
                                <argument>aggregate.py</argument>
                                <argument>${}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

org.codehaus.mojo
execmaven插件
${maven.exec.version}
编译
执行官
蟒蛇3
src/main/python
聚合.py
${}
从命令行,我们可以传递像
-q
aka
-quiet
这样的标志。对于
aggregate.py
的第二个参数,如何将
-q
标志或任何其他标志传递到python脚本中,以便它在运行时也能遵守日志级别的请求


如果我们只使用一个定制的param,这当然很容易,但是我想使用内置的param来获得更无缝的体验。如何跟踪
-q
-quiet

您可以查看
exec-maven插件的可选参数列表

对于
——相当
,只需添加到插件配置

<quietLogs>true</quietLogs>
true

我知道我可以添加这个,但我只想在
-q
标志打开的情况下添加它——那么我如何检查pom中是否打开了它?我现在明白你的意思了。但我不确定maven是否允许传播这些命令行选项以供自定义使用。使用不同配置文件的一个选项。