[英]Enable exec-maven-plugin while executing jar through java command
I am using exec-maven-plugin to execute a shell script. 我正在使用exec-maven-plugin执行shell脚本。
<executions>
<execution>
<id>exec-ui-install</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>bash</executable>
<arguments>
<argument>${basedir}/ui-build.sh</argument>
</arguments>
<skip>${exec.skip}</skip>
</configuration>
</execution>
</executions>
I dont want this to run during build time (as i don't need to run it during build and i am building it from windows). 我不希望它在构建期间运行(因为我不需要在构建期间运行,而是从Windows构建它)。 So i am using a parameter named exec.skip and with its help i am able to skip it.
所以我正在使用一个名为exec.skip的参数,借助它的帮助,我可以跳过它。
After building jar and moving it to Linux env i am using java command Ex: java -cp : javaclass to run the jar. 构建jar并将其移至Linux env之后,我正在使用java命令Ex:java -cp:javaclass运行jar。 During this i need to execute "exec-maven-plugin" which was disabled during build mode.
在此期间,我需要执行在构建模式下被禁用的“ exec-maven-plugin”。 How do i pass "exec.skip=true" through java command so that i can run plugin.
我如何通过java命令传递“ exec.skip = true”,以便我可以运行插件。
You cannot do it. 你做不到。
The maven configuration of a project is used during the build of the project. 在项目的构建过程中将使用项目的Maven配置。
Once the artifact/component is constructed, you don't interact any longer with maven. 一旦构建了构件/组件,您就不再与Maven进行交互。
In your case, you should build your component with the suitable configuration parameters before moving it to linux. 对于您的情况,在将组件移至linux之前,应使用适当的配置参数来构建组件。
Using a Maven profile with this specific configuration that is launched by a continuous integration tool could ease the task and make it reliable. 使用由持续集成工具启动的具有特定配置的Maven配置文件可以简化任务并使其可靠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.