Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.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 exec maven插件参数和commandlineArgs之间的差异_Java_Maven_Exec Maven Plugin - Fatal编程技术网

Java exec maven插件参数和commandlineArgs之间的差异

Java exec maven插件参数和commandlineArgs之间的差异,java,maven,exec-maven-plugin,Java,Maven,Exec Maven Plugin,我正在尝试将execmaven插件与java目标结合使用。然而,我对这两种选择之间的差异感到困惑: 论据 命令行args 如果我尝试使用参数,对java类的调用就会失败 被调用的我的类的签名是: public static void main(String[] args) { VeracodeParser parser = new VeracodeParser(); parser.parse(args); } 我的pom: <plugin&g

我正在尝试将execmaven插件与
java
目标结合使用。然而,我对这两种选择之间的差异感到困惑:

  • 论据
  • 命令行args
如果我尝试使用参数,对java类的调用就会失败

被调用的我的类的签名是:

 public static void main(String[] args)
  {
    VeracodeParser parser = new VeracodeParser();
    parser.parse(args);
  }
我的pom:

        <plugin>
            <artifactId>exec-maven-plugin</artifactId>
            <groupId>org.codehaus.mojo</groupId>
            <executions>
                <execution>
                    <id>Zip packaging and deployment</id>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
                        <arguments>
                            <argument>-action GetAppList</argument>
                            <argument>-vuser ${veracode.username}</argument>
                            <argument>-vpassword ${veracode.password}</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
问题是,
将变得难以操作。这就是为什么我更喜欢使用
参数的原因


有人能给我解释一下两者之间的区别和/或我是否/如何使用
参数吗?

也许你必须以那种方式单独提供你的参数? 据《华盛顿邮报》报道


-行动
GetAppList
-vuser
${veracode.username}
-vpassword
${veracode.password}

看起来就是这样。在对源代码进行了一些挖掘并运行了一些测试之后,我打算自己发布答案。
        <plugin>
            <artifactId>exec-maven-plugin</artifactId>
            <groupId>org.codehaus.mojo</groupId>
            <executions>
                <execution>
                    <id>Zip packaging and deployment</id>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <configuration>
                        <mainClass>com.veracode.apiwrapper.cli.VeracodeCommand</mainClass>
                        <commandlineArgs>-action UploadFile -vuser ${veracode.username} -vpassword ${veracode.password} -appid ${veracode.appId} -filepath ${project.build.directory}/dependency/sbip_ear_pres.ear</commandlineArgs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    <arguments>
        <argument>-action</argument>
        <argument>GetAppList</argument>
        <argument>-vuser</argument>
        <argument>${veracode.username}</argument>
        <argument>-vpassword</argument>
        <argument>${veracode.password}</argument>
    </arguments>