简体   繁体   English

通过Java命令执行jar时启用exec-maven-plugin

[英]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.

相关问题 java maven exec-maven-plugin没有在mvn clean install上执行 - java maven exec-maven-plugin not executing on mvn clean install 运行 exec-maven-plugin java 时如何获取“[DEBUG] Executing command line:” - How to get “[DEBUG] Executing command line:” when running exec-maven-plugin java Maven在测试阶段之前运行类:exec-maven-plugin exec:java不执行类 - Maven run class before test phase: exec-maven-plugin exec:java not executing class 执行 org.codehaus.mojo:exec-maven-plugin:1.6.0:exec: java.lang.String 不能转换为 org.codehaus.mojo.exec.Modulepath - while executing org.codehaus.mojo:exec-maven-plugin:1.6.0:exec: java.lang.String cannot be cast to org.codehaus.mojo.exec.Modulepath 具有限定名称的Java Maven exec-maven-plugin ClassNotFoundException - Java Maven exec-maven-plugin ClassNotFoundException with Qualified Name 使用 exec-maven-plugin 进行调试 - Debugging with exec-maven-plugin 如何在exec-maven-plugin中手动指定java路径 - How to manually specify java path in exec-maven-plugin exec-maven-plugin因执行Java主类而挂起 - exec-maven-plugin hangs with execute Java main class exec-maven-plugin未在src / main / java中检测类 - exec-maven-plugin not detecting class in src/main/java NetBeans项目中的exec-maven-plugin Java版本不同于maven-compiler-plugin Java版本 - exec-maven-plugin Java version different from maven-compiler-plugin Java version in NetBeans project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM