开发者社区> 问答> 正文

如何用exec-maven-plugin插件执行jar包??报错

如标题所问,使用下面配置会报错找不到文件,但目录下确实有这个jar包(目录问题排除)

 执行注释的run.bat没有问题,求帮助

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java -jar tlog-gen-1.0.0-jar-with-dependencies.jar</executable>
                            <!--<executable>run.bat</executable>-->
                        </configuration>
                    </execution>
                </executions>
            </plugin>



展开
收起
爱吃鱼的程序员 2020-06-12 15:45:15 1339 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    solution:参数需要另外 配置   link  

    <executable>java</executable>

    <arguments>

    <argument>-jar</argument>
    <argument>target\XXX.jar</argument>
    </arguments>

    question:为什么要绑定在generate-sources上执行?

    完美解决问题;绑定在generate-sources上是为编译时提前自动生成代码
    2020-06-12 15:45:33
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载